简体   繁体   English

使用TFS构建进行多个Web部署打包

[英]Multiple web deployment packaging using TFS build

We have several web services that we have been deploying "manually" using msdeploy . 我们有几个使用msdeploy “手动”部署的Web服务。 We pick up the deployment packages from the TFS2010 build machine in the appropriate _PublishedWebsites\\<<ProjectName>>_Package directory. 我们从相应的_PublishedWebsites\\<<ProjectName>>_Package目录中的TFS2010构建机器中获取部署包。

We now want to wrap the deployment packages up with a deployment tool that makes it easier for the person doing the installation to see the parameters. 我们现在想要使用部署工具包装部署包,使安装人员更容易查看参数。

What we'd like to do is to build the individual web service deployment packages, have the deployment packages land in the right place for the deployment tool build and then have the deployment tool build both build the tool and copy the previously-built deployment packages to the same Binaries drop folder on the build machine. 我们要做的是构建单独的Web服务部署包,让部署包位于适合部署工具构建的位置,然后让部署工具构建构建工具并复制以前构建的部署包到构建计算机上相同的Binaries drop文件夹。

For some reason, this seems incredibly difficult to do. 出于某种原因,这似乎难以置信。

Things we've tried 我们尝试过的事情

  • Setting Location where package will be created on the web services project's Package/Publish Web project settings using a variable (eg $(TargetDir) ). 使用变量(例如$(TargetDir) )设置在Web服务项目的Package / Publish Web项目设置中创建包的位置 Visual Studio interprets the entered variable and replaces it with the hard-coded path for the development machine... and that's what goes to the build machine. Visual Studio解释输入的变量并将其替换为开发机器的硬编码路径......这就是构建机器的内容。 On the build machine the end result is... nothing; 在构建机器上,最终结果是......什么都没有; the deployment packages are still sent to _PublishedWebsites\\<<ProjectName>>_Package . 部署包仍然发送到_PublishedWebsites\\<<ProjectName>>_Package

  • Setting /p:PackageLocation on as one of the MSBuild Arguments settings on the TFS build definition "Process" / "Advances" section, in addition to /p:CreatePackageOnPublish=true /p:DeployOnBuild=true . 设置/p:PackageLocation作为TFS构建定义“Process”/“Advances”部分上的MSBuild Arguments设置之一,除了/p:CreatePackageOnPublish=true /p:DeployOnBuild=true All this did was generate the error: 所有这一切都产生了错误:

    MSB1008: Only one project can be specified. Switch: p:PackageLocation=$(BinariesRoot)\\DeploymentFiles For switch syntax, type "MSBuild /help"

    presumably because there is more than one deployment package being generated by the build. 可能是因为构建生成了多个部署包。

Any advice appreciated! 任何建议赞赏! Are we going about this the wrong way? 我们是否采取了错误的方式? Should we be doing something like altering the build XAML to cater for this (like this page suggests for another issue)? 我们应该做一些改变构建XAML以满足此需求( 如此页面建议的另一个问题)吗?

Couple possibilities for you to consider: 您可以考虑的几种可能性:

1 - Alter the TFS workflow like you've described to perform some copy task 1 - 改变您所描述的TFS工作流程以执行某些复制任务

2 - Create an MSBuild project that runs after your standard Packaging steps to copy the output from _PublishedWebsites to some location of your choice 2 - 创建一个MSBuild项目,该项目在标准打包步骤之后运行,以将_PublishedWebsites的输出复制到您选择的某个位置

3 - Override the following MSBuild parameter when building the package to change the package drop location: 3 - 在构建程序包时更改以下MSBuild参数以更改程序包删除位置:

 <DefaultPackageOutputDir Condition="'$(DefaultPackageOutputDir)'==''">$(OutDir)[YourDesiredLocation]\$(DefaultMSDeployDestinationApplicationName)\Package</DefaultPackageOutputDir>

Note that you can see the set of packaging MSBuild parameters available to you at 请注意,您可以在此处查看可用的包装MSBuild参数集

 c:\program files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets

I recently implemented suggestion #2 at a client, using the MSBuild overrides suggested in #3 in the custom MSBuild project file and it worked like a charm. 我最近在客户端实现了#2的建议,使用自定义MSBuild项目文件中#3中建议的MSBuild覆盖,它就像一个魅力。

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

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