Last year May, I spoke at DevDays Durban about what is new in ASP.NET 4? One of the highlights of that talk is a feature called Web.Config transforms. In short you have a base web.config and then a file per compiler target (i.e. RELEASE, DEBUG). These extra files contain rules on how to transform your web.config when it is published.
In a way of an example you have might your web.config to use your local SQL Server when in Visual Studio, but when you publish a DEBUG build to testing it changes the config to use the test SQL Server. Or when you publish to production it turns off a bunch of logging and shows friendly error messages.
There is TWO caveats in this process:
- ONLY works for ASP.NET* projects as this is something the ASP.NET team built into their publishing tool support.
- ONLY works for publish, if you have an ASP.NET* project and hit F5, nothing happens
*ASP.NET = ASP.NET Core, and thus systems that build on top of it (WebForms, MVC & WebPages) all get it.
So now you get the full experience on any project type, PLUS you get a brilliant feature missing in the ASP.NET one – PREVIEW. You can see what the resulting config will look like!