Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop config transformation inserts being inserted twice?

Like most people I'm using teamcity as a CI tool and I'm also using web config transformations quite heavily, a lot of times to insert config values.

My build process is generally to build the entire solution and then (using msdeploypublish) deploying the website to a website.

Because I'm running msbuild twice, the config transformations are being run twice and so I'm ending up with duplicate values in the final versions of the config files (mainly web.config but I have others as well).

Is there a way to only run the config transformations the one time, for example by using a parameter in msbuild that will stop it from happening?

like image 697
Piers Karsenbarg Avatar asked May 28 '13 13:05

Piers Karsenbarg


People also ask

What is xdt Transform?

XDT is a simple and straight forward method of transforming the web. config during publishing/packaging. Transformation actions are specified using XML attributes defined in the XML-Document-Transform namespace, that is mapped to the xdt prefix.

How do I create a new transformation in web config?

If you have a web application project, Right-click on web. config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).

How do I rename a web config transform?

If you are using the extension Configuration Transform go to Build > Configuration Manager and find the Configuration dropdown for the project of which you want to change the app config. You can then select the edit and rename the build configurations for that project.


1 Answers

I've found the slightly undocumented InsertIfMissing which seems to do the job.

like image 160
Piers Karsenbarg Avatar answered Oct 18 '22 18:10

Piers Karsenbarg