使用的MSBuild和CSPack任务打包Azure的角色角色、任务、MSBuild、CSPack

由网友(人之初性本贱)分享简介:我的工作在构建脚本为Azure的Web角色项目。该脚本将运行构建的服务器上,因此使用VS是一个非首发。I am working on a build script for an Azure web role project. The script will run on a build server, so usin...

我的工作在构建脚本为Azure的Web角色项目。该脚本将运行构建的服务器上,因此使用VS是一个非首发。

I am working on a build script for an Azure web role project. The script will run on a build server, so using VS is a non-starter.

我可以使用的MSBuild建设项目并使用的cmdlet为天青处理部署(通过PowerShell的) 。是缺少的部分是建立云计算套件。我可以使用包含在SDK中的CSPack.exe工具,但我想如果可能的话用的MSBuild任务,因为这样我可以利用生成配置选项,并与过程的其他部分整合创建包。

I can build the project using MSBuild and use CmdLets for Azure to handle the deployment (via PowerShell). The part that is missing is the creation of the cloud package. I can use the CSPack.exe tool that is included in the SDK, but I would like to use MSBuild tasks if possible, as that way I can leverage the build configuration options and integrate the creation of the package with the rest of the process.

我在Azure的网络部署项目周围挖,但我无法找到的CSPack任务的任何引用。可能有一些VS魔术在这里发生的,除非我很想念引用CSPack / Azure的任务文件。我期待在该大会是Microsoft.ServiceHosting.Tools.MSBuildTasks.dll - 反射告诉我,CSPack任务是在那里

I've dug around in the Azure web deployment project, but I can't find any references to the CSPack task. There might be some VS magic happening here, unless I am missing the file that references the CSPack/Azure tasks. The assembly that I am looking at is Microsoft.ServiceHosting.Tools.MSBuildTasks.dll - reflector tells me that the CSPack Task is in there.

有没有人成功地运用了CSPack MSBuild任务?如果是这样,任何指针,如何使用这将是非常有益的!

Has anyone successfully used the CSPack MSBuild task? If so, any pointers as to how to use it would be very helpful!

如果我吠叫起来完全错了,请让我知道!

If I am barking up the completely wrong tree, please let me know!

谢谢, 埃里克

推荐答案

该CSpack任务是 Microsoft.CloudService.Targets 的MSBuild文件的一部分。在默认安装,这是在

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

C: Program Files文件(x86)的的MSBuild 微软 CloudService 1.0 的Visual Studio 10

C:Program Files (x86)MSbuildMicrosoftCloudService1.0Visual Studio 10

您会看到任何.ccproj(云服务)项目参照本

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

<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)MicrosoftCloud Service1.0Visual Studio 10.0</CloudExtensionsDir>

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

从那里你可以得到的基本格式和一些变化。作为一个例子,这是使用它的CorePublish靶

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>

我们调用此方法来生成我们的云套餐。若t这里是您在需要咨询的特定情况下,请提供详细信息。我们的用法是pretty的普通,我们只是(像你)没有兴趣使用的MSBuild调用了命令行。

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 /吨:CorePublish

如果你有多个层次的项目文件夹的解决方案,并要打包的发行位

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

的MSBuild MyAzureProject MyAzureProject.ccproj /吨:CorePublish /属性:SolutionDir = .. / p:配置=发布

阅读全文

相关推荐

最新文章