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.
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!