Using MSBuild and CSPack task to package Azure roles

牧云@^-^@ 提交于 2019-12-04 02:48:03
Taylor Bird

The CSpack task is part of Microsoft.CloudService.Targets msbuild file. On a default install this is at

C:\Program Files (x86)\MSbuild\Microsoft\CloudService\1.0\Visual Studio 10\

You'll see the reference to this in any .ccproj (cloud service) project

<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\Cloud Service\1.0\Visual Studio 10.0\</CloudExtensionsDir>

<Import Project="$(CloudExtensionsDir)Microsoft.CloudService.targets" />

From there you can get the basic format and several variations. As an example, this is the CorePublish target using it

<CSPack
  ServiceDefinitionFile="@(ServiceDefinitionCopy)"
  Output="$(OutDir)Publish\$(ProjectName).cspkg"
  PackRoles="@(Roles)"
  SiteMapping="@(SiteMapping)"
  RoleProperties="@(RoleProperties)"
  CopyOnly="false"
  >
</CSPack>

We invoke this way to generate our cloud packages. If t here is a particular scenario you are needing advice on, please provide that detail. Our usage is pretty common, we just (like you) had no interested in using msbuild to invoke out to the command line.

So piecing everything together, one can simply issue

msbuild MyAzureProject.ccproj /t:CorePublish

or if you have a solution with multi-leveled project folders and want to package the Release bits

msbuild MyAzureProject\MyAzureProject.ccproj /t:CorePublish /Property:SolutionDir=..\ /p:Configuration=Release

I am using them but I have Visual Studio and the Azure SDK 1.3 installed on the build servers. I could not find any way around that. You may get away with using Visual Studio Express on the build servers so you may want to give that a try first.

I am just using

<Exec Command="$(PackageCommand)" WorkingDirectory="$(BuildProjectFolderPath)\..\main\source\" />

where PackageCommand is what you use in the command line to call cspack.exe.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!