- Deploying to Windows Azure
- The CSPack Command Line Tool
- Automating the Creation of your deployment package
Those of you who have deployed solutions to Windows Azure in the past will know the routine. That is, you must:
- Create an account and then login to the Windows Azure portal (this is done through http://azure.com but for the purposes of this article I am going to use the tech preview site).
- Create a cloud service project for your account – in the following image I have 3 cloud services in my PDC08 CTP account:
- Then click on a Cloud Service project to access the user interface to upload new deployments and toggle them between staging and production:
The CSPack Command Line Tool
CSPack.exe is a tool which comes as part of the Windows Azure SDK and, when installed, it can be found at C:\Program Files\Windows Azure SDK\v1.0\bin\cspack.exe
As per the documentation for CSPack, the syntax for using this tool to create a package is:
And the options that we are interested in are:CSPack <service-definition-file> [options]
Argument | Description |
/out: <file | directory> | This option indicates the output format and location for the role binaries. |
/role:<rolename>;<role-binaries-directory>; | This option specifies the directory where the binaries for a role reside and the DLL where the entry point of the role is defined. The command line may include one /role option for each role in the service definition file. |
And actual sample usage would look something like this:
cspack \ServiceDefinition.csdef /role:AmbientPlacesWebRole;\CloudService.WebRole /out:AmbientPlaces.cspkg
In this example you can see that we are passing in the path to the .csdef file which describes the definition of our service, including what configuration items that we are specifying. Next we pass through the directories and names for each role that is specified in our Cloud Service Defnition (.csdef) file. Finally we can optionally be explicit in specifying the name and location of our outputted Cloud Service Package (.cspkg).
Automating the Creation of your deployment package
Building the solution as part of our automated build process is very similar to what we did when we created our SharePoint deployment package my previous article on the topic:
Except that, instead of using WSPBuilder.exe, we would use CSPack.exe in those places.
You can refer to my previous article to see how we did it for SharePoint packages, but for building Cloud Service packages I would refer you instead to the following blog post which does an excellent job of explaining on way to do the same thing from an MS Build script:
http://blogs.msdn.com/domgreen/archive/2009/09/29/deploying-to-the-cloud-as-part-of-your-daily-build.aspxAnother option that is available is to use the Windows Azure PowerShell Cmdlets to customize your deployment process:
http://blogs.msdn.com/chabrook/archive/2009/10/26/azure-powershell-cmdlets-announced.aspx
No comments:
Post a Comment