App.Config Ignored After Pre-Build Event

Posted by Jake Hulse on Stack Overflow See other posts from Stack Overflow or by Jake Hulse
Published on 2011-03-16T00:06:52Z Indexed on 2011/03/16 0:10 UTC
Read the original article Hit count: 817

I have a solution with several projects and several developers, each with their own environment (of course). To manage connection strings between each environment, I have created several app.config files for each environment: app.config.dev, app.config.qa, etc.

The pre-build event simply copies the app.config.$(ConfigurationName) to app.config. This pre-build event is done for each project in the solution, and the config string is included in each (including the test project).

When I use the pre-build events to manage the app.config files, the connection string cannot be found. I can get the tests to run fine by 2 methods: 1. Do not use the pre-build events to manage the app.config file selection, and do it myself or 2. If I check out app.config and make it writable, then the pre-build events work just fine.

We are using Visual Studio 2008.

I'm down to my last grey hair here, any ideas? Thanks in advance!

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about visual-studio-2008