views:

787

answers:

4

For Visual Studio 2010 Web based application we have Config Transformation features by which we can maintain multiple configuration files for different environments. But the same feature is not available for App.Config files for Windows Services/WinForms or Console Application.

There is a workaround available as suggested on the following link.

http://vishaljoshi.blogspot.com/2010/05/applying-xdt-magic-to-appconfig.html

However it is not straightforward and requires no of steps. Is there an easier way to achieve the same for App.Config files?

+3  A: 

I've come across the following article which looks a bit simpler but I've not tried it myself.

http://fknut.blogspot.com/2009/11/appconfig-transformation-with-new.html

Also, there is a feature request on MS Connect which might be worth voting up so this gets included across the board in the next SP or version.

https://connect.microsoft.com/VisualStudio/feedback/details/564414

Kim R
+2  A: 

I have created another alternative to the one posted by Vishal Joshi where the requirement to change the build action to Content is removed and also implemented basic support for ClickOnce deployment. I say basic, because I didn't test it thoroughly but it should work in the typical ClickOnce deployment scenario.

The solution consists of a single MSBuild project that once imported to an existent windows application project (*.csproj) extends the build process to contemplate app.config transformation.

You can read a more detailed explanation at Visual Studio App.config XML Transformation and the MSBuild project file can be downloaded from GitHub.

João Angelo
+1  A: 

I solve this problem with this tool http://ctt.codeplex.com/. I use it with CCNet/nAnt script for making packages.

outcoldman

related questions