How do you get KUDU to use MSBuild 15

☆樱花仙子☆ 提交于 2020-04-11 08:45:30

问题


Microsoft.Net.Compilers is only supported on MSBuild v15.0 and above

whatever the auto detect tooling is for KUDU, it always selects 14

is there a way for force it to select 15?


回答1:


Add an app-setting for your Web App:

MSBUILD_PATH with the value %MSBUILD_15_DIR%\msbuild.exe

This will be picked up by the default deploy script.




回答2:


The msbuild 15 is now available in Azure, however it's not default you need to add a custom deployment script to override Kudu's project detection logic .

As watashiSHUN described you could add something like this:

nuget restore "%DEPLOYMENT_SOURCE%\{SolutionPath}"
"%MSBUILD_PATH%" {MSBuildArguments}

And here is the template and the issue in the github.




回答3:


msbuild 15 is not used by default. You can use it, with a little modification to your Kudu script.

Here is an example using msbuild 15 for restore, build and publish*.

:: 1. Restore nuget packages
call :ExecuteCmd nuget.exe restore "%DEPLOYMENT_SOURCE%\BACON.sln" -MSBuildPath "%MSBUILD_15_DIR%"
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. Build and publish
call :ExecuteCmd "%MSBUILD_15_DIR%\MSBuild.exe" "%DEPLOYMENT_SOURCE%\BACON.WEB.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="%DEPLOYMENT_TEMP%" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error

* change BACON.sln & BACON.WEB.csproj to your project file names



来源:https://stackoverflow.com/questions/55621822/how-do-you-get-kudu-to-use-msbuild-15

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!