Visual Studio 2010 doesn’t have the same support for app.config files in the way that their web projects do, in order to vary connection strings and other configuration settings for different release modes – a real shame. You can vote on the issue here. In the meantime though, the ASP.NET team have a fix, detailed here.
All you need to do is save their custom targets file, add an imports tag immediately before the closing tag:
... <Import Project="$(MSBuildExtensionsPath)\Custom\TransformFiles.targets" /> </Project>
And add a TransformOnBuild metadata property to each config file you want transformed. So
<None Include="app.config" />
<None Include="app.config"> <TransformOnBuild>true</TransformOnBuild> </None>
(note you don’t need to do this on the configuration specific config files such as app.release.config). Then you can write your app.Release.config and similar files in the same way you do for web.config files. Sweet!