使MSDeploy.exe将msbuild生成的.zip包部署到Azure [英] Make MSDeploy.exe deploy a msbuild generated .zip package to Azure
问题描述
我们拥有ASP.NET MVC Web应用程序,可通过VS(2017)中的发布..."成功部署到Azure.现在如何从我们的Powershell脚本发布Web软件包(在本地或在TFS上运行)?
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)?
我们这样做:
MSBuild "webproject.csproj" /t:Package
和webproject.cmd
,webproject.zip
和其他一些文件生成.在.cmd文件中,它调用msdeploy.exe
.然后使用Azure中的发布文件,执行以下操作:
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
并以:
错误代码:ERROR_NOT_SUPPORTED 详细信息:此服务器环境不支持创建新的应用程序.了解更多信息: http://go.microsoft.com/fwlink/?LinkId= 221672#ERROR_NOT_SUPPORTED . 错误计数:1.
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.
是的,我们可以通过MSBuild进行操作,但是使用版本控制而不是我们的程序包,如
Yes, we can do it via MSBuild but that uses the version control, not our package, like described at here.
推荐答案
解决方案是使用发布设置文件中的站点名称和连接字符串来修改webproject.SetParameters.xml
文件.并且不要忘记将/Y
设置为实际发布.而且效果很好!
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!
这篇关于使MSDeploy.exe将msbuild生成的.zip包部署到Azure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!