A common problem is the need of different configurations in development, test and production environments. For example it's very common to have different databases, and therefore its necessary to modify the connectionStrings section when moving from development to test.
Visual Studio 2005 Web Deployment Projects contains a solution for this, but since it's a MSBuild tasks it is also useful in other deployment scenarios, than just web projects. The build task is called ReplaceConfigSections and can be found in Microsoft.WebDeployment.Tasks.dll assembly. To be able to use it in for example a winform project, it's necessary to manually modify the project file (which is a MSBuild file) and add a UsingTask and then later use it in the build.
<UsingTask
Taskname="ReplaceConfigSections"
AssemblyFileName="[Path]\Microsoft.WebDeployment.Tasks.dll" />