.NET Framework Developer Center >
.NET Development Forums
>
MSBuild
>
Web deployment project - replace multiple sections in configure file
Web deployment project - replace multiple sections in configure file
- How can I put all the sections to be replaced in web.config in one file?
I would get compile error: XML document cannot contain multiple root level elements.
configSections=web.PROD.config;
loggingConfiguration=web.PROD.config;
connectionStrings=web.PROD.config;
system.diagnostics=web.PROD.config;
appSettings=web.PROD.config;
system.web=web.PROD.config;
system.codedom=web.PROD.config;
system.webServer=web.PROD.config;
system.serviceModel=web.PROD.config;
All Replies
- Hi Guoqingyu,
I have read your thread carefully, but I am not sure I understood clearly, could you please post more detailed? Do you mean put all sections in web.config file? why you do want to do that?
Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. - If I understand you correctly, you want to move real configuration sections in web.config to seperate files and reference them in the web.config. It makes the mantaince more difficult in my purspective. What's your intention?
- Thanks for helping me with my question. if you read the title of my question - Web deployment project - replace multiple sections in configure file. I am trying to create a installation file (MSI) for production. So I can just run the setup/MSI on production server to install the updated website. It's common for replacing the connection strings. but if I have other sections to replace for the web.config on production, I would run into this issue here - I have to seperate them into different files.
- I thought you were using Web Deployment Projects template. Now I understand you are trying to create an MSI package and I think I need more information:
1. How do you create the MSI package? Do you use WIX or VS setup project template?
2. Do you get the compilation error when you build the setup project or when you build your web site?
Replacing configuration sections is a common task during the deployment. In VS 2010, there will be an MSDeploy enhance it. See http://blogs.msdn.com/webdevtools/archive/2009/02/04/web-deployment-with-vs-2010-and-iis.aspx for more information. - thanks, Bill.
to answer your question.
1. I am creating MSI with VS setup project template
2. I get the compilation error when I build the setup project (actually the deployment project)
I am just trying to put multiple sections in one file to be replaced in production web.config.
such as,
configSections=web.PROD.config;
loggingConfiguration=web.PROD.config;
connectionStrings=web.PROD.config;
system.diagnostics=web.PROD.config;
appSettings=web.PROD.config;
system.web=web.PROD.config;
system.codedom=web.PROD.config;
system.webServer=web.PROD.config;
system.serviceModel=web.PROD.config;


