Click here to Skip to main content
15,908,626 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I'm preparing to deploy a ASP.NET web application.
The target server has already a previous version of my web application with parameters specified on the web.config file.

In the new version of this web application, the web.config file contains new sections I would like they appear on the target web.config on the server.

However I can't find the way to merge the new web.config sections into the existing web.config file ? :((

Does I have to do that programmatically, or is there a tool to merge the both files during installation ? (I'm using Web Setup Project).

Thanks a lot for your answer :thumbsup:
Posted
Updated 30-Mar-10 3:44am
v3

Perhaps I've completely misunderstood you in which case ignore me but couldn't you just copy the required sections into the new Web.config and then the deploy action will, essentially, copy the new Web.config over the old?
 
Share this answer
 
Web.Config file is a physically available file... you can locate it. As you say, 2nd config file is a newer version, this means all the configuration setting must be same.. just few new 'keys' added.

Pullout the old one, add the new keys to the new one. Replace it!

In case, if any other configuration is also missing/changed... add/modify/rectify it. No need for any programmtic way.... if you are not aware, web application can have onley ONE Web.config file.
:thumbsup:
 
Share this answer
 
As web.config is the heart of web application, I will recommend to manually modifying it in the server.

Also, it is available in the server. So, the new changes will be less and you know those changes. Better is to modify it manually. If you are sure that, you have the latest one & nothing has been changed in the server, then just overwrite it.

Though there are various tools available in the market & you will get those if you search over net, again i will recommend you to manually modifying it as it is the heart of the server. If anything goes wrong, it will take most of your efforts than manual deploy.
 
Share this answer
 
Thank you for your answers ! Sorry but I forgot to mention that what I need is an automatic merging of the new Web.config file to the previous one during installation.

Because the web application is deployed on several servers, and at different places. And each one contains it own settings into the already installed web.config file.

Thanks again for your help !

UPDATE SM: As i already suggested[^], you can get the old copy... put all the changes that needs to be there as per old one into the new Web.Config file. And then let the installation use the new web.config file replace old one.

UPDATE Vincenzo_id: Thank you Sandeep Mewara for your answer. I just hoped I could find an existing tool to do this standard job.
Thanks again.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900