使用MSBuild发布Azure应用程序

使用MSBuild发布Azure应用程序

问题描述:

Visual Studio 2013具有用于Cloud Service项目的发布向导,该向导基于.azurePubxml文件中保留的设置来打包和部署云服务.

Visual Studio 2013 has a publish wizard for Cloud Service projects that packages and deploys a cloud service based on settings persisted in a .azurePubxml file.

我正在CI服务器上设置此过程的自动化,并希望在MSBuild中利用此功能,但是我不确定是否有可能.

I'm setting up automation of this process on a CI server, and want to leverage this functionality within MSBuild, but I'm unsure if it's even possible.

我发现很多文章都讨论了如何将PowerShell脚本化,并使用自定义MSBuild目标文件进行部署,但这似乎是信息的重复,我不想深入研究.

I have found a lot of articles that talk about shelling out to a PowerShell script and using a custom MSBuild target file to do the deploy, but that seems like a duplication of information that I'd rather not delve into.

鉴于我已在构建计算机,VS 2013和Azure SDK 2.2上安装了Azure订阅凭据,我可以调用VS 2013在发布向导中使用的相同机制来打包和部署我的云服务吗?

Given that I have the Azure subscription credentials installed on the build machine, VS 2013, and Azure SDK 2.2, can I invoke the same mechanism that VS 2013 uses in the publish wizard to package and deploy my cloud service?

当前,将MSBuild与publish目标一起使用,我可以将服务打包到.cspkg文件中,但是我无法弄清楚如何基于定义VS构建配置文件的配置文件(.azurePubxml文件)触发打包/部署. ,以及所有Azure设置.

Currently, using MSBuild with the publish target, I can package the service into a .cspkg file, but I cannot figure out how to trigger to package/deploy based on a profile (.azurePubxml file) that defines the VS build config, and all of the Azure settings.

因此,正如您所指出的那样,默认目标只会给您一个包.从那里开始,Visual Studio使用自己的基础结构发布内容.从CI服务器发布构建被认为是实际构建过程之外的事情,而是部署过程中的一部分.

So, as you pointed out, the default targets will only give you a package. From there, Visual Studio is publishing things using their own infrastructure. Publishing the build from a CI server is considered something external to actual build process and rather something that is part of the deployment process.

如果您的CI技术支持PowerShell,那么就像自动化Windows Azure PowerShell cmdlet进行投标一样简单. 有一篇非常详细的文章介绍了如何使用团队在MSDN上的TFS中建立.

If your CI technology has support for PowerShell then it's as easy as automating the Windows Azure PowerShell cmdlets to do your bidding. There's a nicely detailed article on how you might do this with Team Builds in TFS here on MSDN.