Note that there are some explanatory texts on larger screens.

plurals
  1. POApp.Config Ignored After Pre-Build Event
    text
    copied!<p>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.</p> <p>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 connection string is included in each (including the test project).</p> <p>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.</p> <p>We are using Visual Studio 2008 with VSS.</p> <p>I'm down to my last grey hair here, any ideas? Thanks in advance!</p> <p><strong>SOLUTION</strong> Update the pre-build event to ensure the app.config file is writable even if it is checked in. Pre-Build event used below:<br> <code>@echo off</code> </p> <p><code>attrib -r $(ProjectDir)app.config</code><br> <code>if errorlevel 1 goto AttribFailed</code> </p> <p><code>copy $(ProjectDir)app.config.$(ConfigurationName) $(ProjectDir)app.config</code><br> <code>goto BuildOK</code></p> <p><code>:AttribFailed</code><br> <code>echo Attrib -r Failed on $(ProjectDir)app.config</code><br> <code>exit 1</code></p> <p><code>:BuildOK</code><br> <code>echo Copy Done</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload