【发布时间】:2017-06-17 11:16:30
【问题描述】:
我在 Visual Studio 2017 中创建了一个 Azure 函数应用程序(详细信息 here),并且该应用程序在 Visual Studio 中构建时没有出现问题。但是,当我尝试使用 MSBuild 版本 15 从命令行(只需运行 msbuild.exe mysolution.sln)构建应用程序时,会出现以下错误:
error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 这很可能是因为应用程序默认引用了 Microsoft.Azure.WebJobs,如提到的here。
所以我认为我需要以某种方式恢复 Microsoft.Azure.WebJobs 包,但我不确定如何手动恢复 Azure 函数应用程序中的包。我创建了一个project.json 文件并在其中列出了包,但这不起作用。然后我创建了一个packages.json nuget 文件,但它也不起作用。有什么想法吗?
【问题讨论】:
-
您是否尝试过像其他任何基于 msbuild 的项目一样简单地做一个
nuget restore? -
我刚刚尝试使用
nuget restore mysolution.sln并收到消息Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.如果我知道Visual Studio 如何恢复包,我可以复制它。 -
我刚刚尝试了我的测试应用程序 (github.com/davidebbo-test/FunctionAppVS2017_3Preview),
nuget restore后跟msbuild效果很好。确保从 VS 2017 preview 的开发提示中执行此操作。
标签: azure msbuild azure-functions