我使用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.