Powershell - Create Azure Deployment Package

2019-04-12 01:02发布

问题:

I've a web solution with 4 web projects. On successful build I need to create a azure deployment package via powershell.

Could someone help me whether we can create a azure deployment packages (cspkg, csdef and cscfg).

Thanks.

回答1:

Here is a good example: Windows Azure 4: Deploying via PowerShell

Also: Publish a Package using a Powershell Script

This describe the process in detail.



回答2:

For this, your solution must contain cloud projects so that your projects are enabled to be deployed in Windows Azure. See this guide for a step-by-step approach to do so: http://msdn.microsoft.com/en-us/library/windowsazure/hh420322.aspx. Then, when you build your cloud projects (either through msbuild or directly through Visual Studio), you'll get package files.



回答3:

I wrote an article about build package files and uploading them to Azure using Powershell which might be useful:

http://www.kenneth-truyers.net/2014/02/06/deploying-cloud-services-to-azure-with-powershell/

Creating a package is rather simple. You can use Msbuild for that:

exec { msbuild <path-to-csproj> /p:Configuration=Release 
                                /p:DebugType=None
                                /p:Platform=AnyCpu
                                /p:OutputPath=<path-to-package>
                                /p:TargetProfile=Cloud
                                /t:publish
                                /verbosity:quiet }