azure - Visual Studio 2017 MSBuild 无法构建 Azure Functions

标签 azure msbuild visual-studio-2017 azure-functions

我已经使用 Visual Studio 2017(专业版)创建了 azure 函数,我可以在 Visual Studio 中成功构建 azure 函数,

但我有一个要求,我必须在没有 Visual Studio 2017 的情况下构建和创建包,因此我尝试从 MSBuild 2017 构建 azure 函数,引用链接:https://blogs.technet.microsoft.com/livedevopsinjapan/2017/09/12/build-and-deploy-azure-functions-without-using-visual-studio-2017/

MSBuild 命令:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "Telemetry.sln" /nologo /nr:false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="WebApp.zip" /p:DeployIisAppPath="Default Web Site" /t:"Telemetry:Clean;Build";"Telemetry_Test:Clean;Build" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0"

执行上述命令,无法构建azure函数

C:\..\MyFunctionAppTest>"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "MyFunctionAppTest.sln" /nologo /nr:false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="WebApp.zip" /p:DeployIisAppPath="Default Web Site" /t:"MyFunctionAppTest:Clean;Build" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0"
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 12/11/2017 6:57:19 AM.
Project "C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" on node 1 (MyFunctionAppTest:Clean;Build target(s)).
ValidateSolutionConfiguration:
  Building solution configuration "release|any cpu".
Project "C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" (1) is building "C:\..\MyFunctionAppTest\MyFunctionAppTes
t\MyFunctionAppTest.csproj" (2) on node 1 (Clean;Build target(s)).
C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' spec
ified could not be found.
Done Building Project "C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj" (Clean;Build target(s)) -
- FAILED.

Done Building Project "C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" (MyFunctionAppTest:Clean;Build target(s)) -- F
AILED.


Build FAILED.

"C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" (MyFunctionAppTest:Clean;Build target) (1) ->
"C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj" (Clean;Build target) (2) ->
  C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' sp
ecified could not be found.

最佳答案

确保在 MS Build 安装中安装 .NET Core 工作负载:

enter image description here

如果没有帮助,请查看 this issue 中的其他评论.

关于azure - Visual Studio 2017 MSBuild 无法构建 Azure Functions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47748272/

相关文章:

javascript - Azure Function 执行速度极慢且不一致

azure - 将多行合并为单行并贡献百分比

python - 来自 Python 中的 Microsoft Translate API 的响应

c++ - 错误 LNK2038 : mismatch detected for '_MSC_VER' : value '1600' doesn't match value '1700' in CppFile1. 对象

msbuild - MS Deploy 可以打包和转换,但不能部署吗?

database - Azure SQL 数据库 : Failover secondary DB is read-only

msbuild - Visual Studio Team Services 中的空构建工件

c++ - 如何在 Visual Studio 2017 中使用 GLOP 线性求解器 [C++]

.net - Visual Studio Express 是否支持 .NET Core

asp.net-mvc - Visual Studio 2017 - 发布菜单中缺少的单个文件