In most real-world deployment scenarios, the web.config file
you use for development is different than the one you use for production
deployment. Typically you want to change environment settings like
database connection-strings, making sure debug is turned off, and enabling
custom errors so that end-users (and hackers) don’t see the internals of your
application.
VS 2010 now makes it easy to customize/tweak/modify your
web.config files as part of your publish/deployment process.
Specifically, you can now easily have build-configuration specific
transformation files that can customize your web.config file prior to the
application being deployed:
You can maintain a separate transform file per Visual Studio
build-environment. For example, you could configure your project/solution
to have a “Debug”, “Staging” and “Release” build configuration – in which case
VS will maintain three separate transform files for you. VS will
automatically apply the appropriate one at deployment time depending on what
your VS environment is set to.
I will dive deeper into how to perform web.config file
transformations in a future blog post.