TFS构建未按预期转换web.config [英] TFS Build not transforming web.config as expected

查看:78
本文介绍了TFS构建未按预期转换web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是让TFS构建和部署2种以上不同的配置,并让web.config转换文件在其输出中包含预期的内容.这是在ASP.NET MVC项目中.

The goal is to have TFS build and deploy 2+ different configurations, and have the web.config transform files include the intended content in their output. This in an ASP.NET MVC project.

Web.Debug.Config-在PasteBin上查看.
Web.Release.Config-在PasteBin上查看

Web.Debug.Config - see on PasteBin.
Web.Release.Config - see on PasteBin

两个转换后的配置文件的 Build Action(构建操作)设置为None(无).对此进行了修改,因为部署中包括了所有3个web.*.config文件.

The 2 transformed config files have their Build Action set to None. This was modified because all 3 web.*.config files were being included in the deployment.

已正确配置TFS以构建和部署这两种配置.它按预期部署到2个放置位置.在构建定义中没有指定MSBuild参数.

TFS is configured correctly to build and deploy both configurations. It deploys to the 2 drop locations as expected. There are no MSBuild Arguments specified in the build definition.

问题:2个已构建和已部署的网站具有相同的web.config文件.基本上,就好像转换后的文件不存在.

Problem: The 2 built and deployed web sites have the same web.config file. Basically it's as if the transformed files did not exist.

预期:指定的更改(xdt:Transform="Replace"xdt:Transform="Remove")将出现在web.config文件中.

Expected: the changes specified (xdt:Transform="Replace" and xdt:Transform="Remove") would be present in the web.config files.

如何配置项目或TFS以确保处理web.config转换并将其输出部署到正确的部署位置?我还能检查/修改什么?

How can you configure your project or TFS to ensure the web.config transformations are processed and their outputs deployed to the correct deployment locations? What else can I check/modify?

  • 已确认转换效果很好- Vishal的Joshit教程在命令行上使用MSBuild 输出正确的转换!
  • 未对任何后生成或部署的.csproj进行任何修改.
  • 是否有任何xdt属性被滥用或丢失?
  • 在构建定义中未指定MSBuild参数.
  • web.config Build Actions是否设置正确?
  • 我们没有使用Web部署程序包或任何东西.只是希望以后再将这些输出复制到其不同的Web服务器位置.
  • Have confirmed that the transformations are good -- Vishal's Joshit's tutorial with the MSBuild on the command line output the correct transformations!
  • No modifications have been made to the .csproj for any post-build or deployment.
  • Are any xdt attributes being misused or missing?
  • There are no MSBuild Arguments specified in the build definition.
  • Are the web.config Build Actions set correctly?
  • We're not using web deployment packages or anything. Simply expecting to xcopy these outputs over to their various webserver locations at a later date.

如果我缺少任何重要信息,请发表评论,我将包括更多相关信息!

If I'm missing any important information, please leave a comment, and I'll include any more relevant information!

推荐答案

以前,我一直在做与其他答案相似的事情.但是,我只是发现了似乎更好的解决方案.只需在您的MSBuild参数中添加"/p:UseWPP_CopyWebApplication = true/p:PipelineDependsOnBuild = false".我只是在我的一个TFS构建中进行了尝试,效果很好.

Previously I had been doing something similar to the other answers. However, I just found what seems to be a better solution to this problem. Just add "/p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false" to your MSBuild arguments. I just tried this out on one of my TFS builds and it works just fine.

我在这里找到了一个很好的提示: http://www.andygeldman.com/index.php/2011/10/web-and-app-config-transformations-with-tfs-build .

I found this great tip here: http://www.andygeldman.com/index.php/2011/10/web-and-app-config-transformations-with-tfs-build.

这篇关于TFS构建未按预期转换web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆