We all knew this case, or we must deploy a web application on a platform other than the one on which the development (dev server, recipe, etc. ...); prod
A minimum one finds oneself to change the connections to the channels / databases, the best there is provided a copy of the web.config tweakée by platform (with a big disadvantage now have to maintain multiple files in parallel), we do this in Emergency and hop it crashes: p.
Probably a bit of configuration that we have not forgotten reported in this conf file specific to the intended environment. It feels lived, all that!Rejoice that time is over!
In Visual Studio 2010, it can implement changes on configuration files. The idea is to have a web.config file as a basis, then for each solution configuration (Debug, Release, etc. ..) a transform file contains the changes made with respect to the base file.
If one adds two configurations of solutions, such as recipe and prod, and then you click on the Add Config Transform two new files appear Web.Recette.config & Web.Prod.config
The idea of this post is not to explain in detail the syntax of transformation well explained on MSDN
but to continue the example here is my original web.config
and processing environmental Recipe:
Okay now the bad news (haaa? j'vous had not said that there was bad news?) is that the transformation of the config file is not in the build.Unfortunately, it only occurs when using webDeploy. The good news? Is that the dealer just csproj can launch the MSBuild task in charge of processing.
Go to the bottom of the file and modify it as follows:
That's it for tonight, I hope this trick will make life easier when your future deployments.
0 comments:
Post a Comment