将 TFS 2010 构建服务器发布到同一文件夹并覆盖
我已经找了很多年了,我很恼火,因为我想做的事情在理论上是如此简单!
我有一个 Web 项目,当我告诉我的 TFS 对新构建进行排队时,我希望我已发布的文件(或未发布的文件 - 我不在乎)最终位于静态文件夹中,例如“C:\inetpub\myproj \网络文件”。
我查看了这篇文章TFS 2010 Build Publish via file system这让我看到了这篇文章团队构建:使用 MSDeploy 在本地发布 但我就是不明白它似乎不起作用。
我的构建定义已全部设置完毕,并且它构建成功,甚至会构建到我指定的文件夹中,但是一旦构建完成,它最终会出现在一堆子文件夹中 - 其中一个附加了版本号,这意味着 IIS 不会自动获取我的最新版本,无需重新配置。 (我确实删除了版本绑定,但它不会用最新版本覆盖最后一个版本)
我目前正在摆弄这些 MSBuild 参数以尝试使其正常工作:
/p:DeployOnBuild=true;
DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder;
_PackageTempDir="\\HomeServer\inetpub\SiteTest";
AutoParameterizationWebConfigConnectionStrings=false
但有几点:
- “SiteTest” ' 文件夹永远不会创建,并且
- 当它是我也想发布的 HomeServer 的本地文件系统时,它是通过共享位置访问的。
我只需要自动将我的 Web 文件放入我可以为 IIS 预先确定的文件夹中,请帮忙!
I've been looking for ages and I'm so exasperated because what I want to do is theoretically so simple!
I have a web project and when I tell my TFS to queue a new build I want my published files(or un-published files - I don't care) to end up in a static folder such as "C:\inetpub\myproj\webfiles".
I've checked out this post TFS 2010 Build Publish via file system which led me to this post Team Build: Publish locally using MSDeploy but I just don't get it and it doesn't seem to be working.
I have my build definition all set up and it builds successfully and will even build into a folder that I specifiy, but once it's built it ends up in a shed load of subfolders - one of which has a version number appended meaning IIS won't automatically pick up my latest version without some re-config. (I did remove the version bindings, but then it won't overwrite the last build with the latest build)
I'm currently messing around with these MSBuild Arguments to try and get it working:
/p:DeployOnBuild=true;
DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder;
_PackageTempDir="\\HomeServer\inetpub\SiteTest";
AutoParameterizationWebConfigConnectionStrings=false
But there's a couple of points:
- The 'SiteTest' folder is never created and
- It's being accessed via share location when it's meant to be the HomeServer's local file system I want to publish too.
I just need to automatically get my web files inside of a folder I can predetermine for IIS, please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过自定义构建过程模板实现了这一点。复制 DefaultTemplate.xaml(例如 DefaultTemplateV2.xaml)并打开它。
如果您是工作流程 xaml 编辑器的新手,我发现首先折叠所有内容会有所帮助。
打开后,单击根序列,然后单击参数。添加三个参数:
然后,在工作流程中打开以下部分:
在序列的底部在获取受影响的测试后,...打开工具箱并拖入“If”工作流程项。将条件设置为 DeployBuild。
在 If 的 Then 部分中,拖动 CopyDirectory 工作流程项。将 Destination 设置为 InstallPath,将 Source 设置为
保存并签入。您需要打开以前的构建并记下要部署的构建子文件夹。它将类似于 _PublishedWebsites\mywebsite\
编辑您的构建定义(您可能必须先关闭并重新打开 VS)并转到“进程”选项卡。将构建过程模板更改为您的新版本。
将 FromPath 设置为您刚刚记下的路径。将 InstallPath 设置为目标文件夹的 UNC 路径(您需要确保运行构建的任何服务帐户都可以访问该路径)并将 DeployBuild 设置为 True。
保存、排队构建并测试您的部署。
您还可以在工作流程 XAML 中转到参数并使用每个新参数编辑元数据参数。您可以设置可以查看它们的位置。例如,您可以将 FromPath 和 InstallPath 设置为仅在编辑定义时查看,而将 DeployBuild 设置为在排队构建时查看。这样您就可以在排队时打开或关闭它。
祝你好运。
I achieved this by customizing our build process template. Make a copy of your DefaultTemplate.xaml (DefaultTemplateV2.xaml for example) and open it.
If you're new to working in the workflow xaml editor I find it helps to collapse all first.
Once it's open, click on the root Sequence and click Arguments. Add three arguments:
Then, in your workflow open these sections:
At the bottom of the Sequence after Get Impacted Tests,.. open your toolbox and drag in an "If" workflow item. Set the Condition to DeployBuild.
In the Then section of the If drag in a CopyDirectory workflow item. Set the Destination to InstallPath and the Source to
Save it and check it in. You'll need to open a previous build and note the build subfolder you want to deploy. It'll be something like _PublishedWebsites\mywebsite\
Edit your build definition (you might have to close and reopen VS first) and go to the Process tab. Change the Build Process Template to your new version.
Set the FromPath to the path you just noted. Set the InstallPath to the UNC path of the destination folder (you'll need to make sure that whatever service account your builds run under has access to that path) and set DeployBuild to True.
Save, queue a build and test your deploy.
You can also, in your workflow XAML, go to Arguments and edit the Metadata argument with each of your new arguments. You can set where they can be viewed. So you could, for example, set the FromPath and InstallPath to only be viewed when editing the definition but DeployBuild to be seen when queuing a build. That way you could turn it on or off when queuing.
Good luck.