Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
562 views
in Technique[技术] by (71.8m points)

visual studio 2010 - TFS Build not transforming web.config as expected

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.

alt text

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

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 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.

alt text

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.

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

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?

  • 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...