Is there a way that I can make configuration replacements for a C# console application in Visual Studio 2010 similar to how it is done through a deploy project for an asp.net/web application project? I have different connection strings and mail settings that I use for test and prod environments so I need an easy way to switch settings when making deployments.
Share
Yes you can. You should create two folders in your project like “config1” and “config2”. Put in each an app.config file that suits the settings you need. Create two project configurations like “Release1” and “Release2”. Open your csproj file in an editor and look for the lines that include both files. In each xml node you can check what is the current selected configuration, and tell VS whether to compile or not each file.
Couldn’t find an example for that but try to look for “multiple app.config”.
Edit: Just found this and it looks great. An addin for VS to use transformations in app.config like web.config
http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx