简体   繁体   English

如何在 TFS Build Server 上启用 Package 创建 Azure 项目

[英]How to enable Package creation of Azure project on TFS Build Server

I am having a WebRole Azure project, and I am planning to generate packages on TFS Build server whenever my solution build is succeeded.我有一个 WebRole Azure 项目,我计划在我的解决方案构建成功时在 TFS 构建服务器上生成包。

Following is a brief of my solution:以下是我的解决方案的简要说明:

  1. Web application. Web申请。
  2. TDD methodology followed in development.开发中遵循 TDD 方法。
  3. 1 web role. 1 web 角色。
  4. two configurations (Cloud and Local)两种配置(云和本地)
  5. ACS based validation.基于 ACS 的验证。

From Visual Studio i am creating packages using the PACKAGE command.在 Visual Studio 中,我使用 PACKAGE 命令创建包。

While running PACKAGE command, I choose following:在运行 PACKAGE 命令时,我选择以下内容:

  1. Service Configuration: Cloud.服务配置:云。
  2. Build Congifuration: Release.构建配置:发布。
  3. Checked: Enable Remote Desktop.选中:启用远程桌面。

What is the process of creating a package on TFS Build server using the same settings as used in Visual Studio?使用与 Visual Studio 中使用的设置相同的设置在 TFS 构建服务器上创建 package 的过程是什么?

Any help is appreciated.任何帮助表示赞赏。

You can use the msbuild CorePublish target for that purpose.为此,您可以使用 msbuild CorePublish 目标。 (see eg this blog post ) (参见例如这篇博文

As a security best practice remote desktop is enabled in the source tree but the actual certificates, remote desktops settings are not in there and added by changing the configuration during deployment.作为安全最佳实践,远程桌面在源代码树中启用,但实际证书、远程桌面设置不在其中,而是通过在部署期间更改配置来添加。 The build configuration just behaves as expected and the ServiceConfiguration flavors will just end up as separate cscfg files.构建配置的行为与预期一致,ServiceConfiguration 风格最终将作为单独的 cscfg 文件结束。

We have a Common.Targets which all projects include, including.ccproj.我们有一个所有项目都包含的 Common.Targets,including.ccproj。 It has:它有:

<Import Project=".\AzurePackages.Targets" Condition=" '$(CloudToolsVersion)' != '' And '$(BuildingInsideVisualStudio)' != 'true'"/>

AzurePackages.Targets (slightly edited): AzurePackages.Targets(略有编辑):

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
  <!-- Create Azure packages -->
  <PackageName>$(AssemblyName).cspkg</PackageName>
  <AzurePackageDir>$(OutDir)Packages\$(AssemblyName).Azure\</AzurePackageDir>
</PropertyGroup>

<Target Name="CopyPackageToOutDir" AfterTargets="Build" DependsOnTargets="CorePublish" Condition="'$(InRecursiveCall)' == ''">
  <Copy SourceFiles="@(PublishServicePackage)" DestinationFolder="$(AzurePackageDir)" />
</Target>

As for configuration, we want to have multiple.cscfg near each package, so we decide which one to take when deploying.至于配置,我们希望每个package附近都有multiple.cscfg,所以我们在部署时决定取哪一个。 We have a solution for that, but it's way too complex for a single question.我们有一个解决方案,但它对于单个问题来说太复杂了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM