使用TFS构建的多个Web部署打包
我们已经使用 msdeploy
“手动”部署了多个 Web 服务。我们从 TFS2010 构建计算机的相应 _PublishedWebsites\<
目录中获取部署包。
现在,我们希望使用部署工具包装部署包,以便安装人员更轻松地查看参数。
我们想要做的是构建单独的 Web 服务部署包,将部署包放置在部署工具构建的正确位置,然后让部署工具构建构建工具并复制先前构建的部署包到构建计算机上的同一 Binaries
放置文件夹。
出于某种原因,这似乎很难做到。
我们尝试
- 过使用变量(例如
$(目标目录)
)。 Visual Studio 解释输入的变量并将其替换为开发计算机的硬编码路径...这就是构建计算机的内容。在构建机器上,最终结果是……什么都没有;部署包仍会发送到_PublishedWebsites\<
。>_Package 除了
之外,还将
。这一切所做的就是生成错误:/p:PackageLocation
设置为 TFS 构建定义“Process”/“Advances”部分上的MSBuild Arguments
设置之一/p:CreatePackageOnPublish=true /p:DeployOnBuild=trueMSB1008:只能指定一个项目。开关:p:PackageLocation=$(BinariesRoot)\DeploymentFiles 对于开关语法,请键入“MSBuild /help”
可能是因为构建生成了多个部署包。
任何建议表示赞赏!我们处理这个问题的方式是错误的吗?我们是否应该做一些事情,例如更改构建 XAML 来满足此要求(例如 此页面建议解决另一个问题)?
We have several web services that we have been deploying "manually" using msdeploy
. We pick up the deployment packages from the TFS2010 build machine in the appropriate _PublishedWebsites\<<ProjectName>>_Package
directory.
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.
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 (e.g.
$(TargetDir)
). 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. On the build machine the end result is... nothing; the deployment packages are still sent to_PublishedWebsites\<<ProjectName>>_Package
.Setting
/p:PackageLocation
on as one of theMSBuild Arguments
settings on the TFS build definition "Process" / "Advances" section, in addition to/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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以考虑以下几种可能性:
1 - 像您所描述的那样改变 TFS 工作流程以执行某些复制任务
2 - 创建一个在标准打包步骤之后运行的 MSBuild 项目,以将输出从 _PublishedWebsites 复制到您选择的某个位置
3 -构建包时覆盖以下 MSBuild 参数以更改包放置位置:
请注意,您可以在我最近在客户端实现建议 #2 中看到可用的打包 MSBuild 参数集
,使用 #3 中建议的 MSBuild 覆盖自定义 MSBuild 项目文件,它的工作就像一个魅力。
Couple possibilities for you to consider:
1 - Alter the TFS workflow like you've described to perform some copy task
2 - Create an MSBuild project that runs after your standard Packaging steps to copy the output from _PublishedWebsites to some location of your choice
3 - Override the following MSBuild parameter when building the package to change the package drop location:
Note that you can see the set of packaging MSBuild parameters available to you at
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.