问题
We have ASP.NET MVC web app that successfully deploys to Azure via "Publish..." in VS (2017). Now how to publish a web package from our Powershell script (run locally or on TFS)?
We do:
MSBuild "webproject.csproj" /t:Package
and webproject.cmd
, webproject.zip
and some other files generated. In the .cmd file it calls msdeploy.exe
. Then with the publish file from Azure, we do:
.\webproject.cmd /T '/M:https://example.scm.azurewebsites.net:443/msdeploy.axd' '/U:USERNAME' '/P:PASSWORD' /a:Basic
and it breaks with:
Error Code: ERROR_NOT_SUPPORTED More Information: Creating a new application is not supported by this server environment. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_NOT_SUPPORTED. Error count: 1.
Yes, we can do it via MSBuild but that uses the version control, not our package, like described at here.
回答1:
The solution is to modify webproject.SetParameters.xml
file with the site name and the connection string from the publish settings file. And not to forget set /Y
switch to actually publish. And it works great!
来源:https://stackoverflow.com/questions/50799830/make-msdeploy-exe-deploy-a-msbuild-generated-zip-package-to-azure