how to merge all web.configs at once for a mvc3 app

孤街醉人 提交于 2019-12-08 04:00:00

问题


I've got a mvc3 app with several configurations (debug, ci, qa, client-dev, client-qa, release). I've got web.configs merging nicely within visual studio for whatever configuration is currently selected in the ide.

So I've got this in my project.

web.config   
 -web.ci.config  
 -web.qa.config  
 - etc..  

I've also got the configs merging properly in cruise control. Unfortunately, I've got to build the entire product to get each config.

Here is what my cruise control config looks like for a single environment.

        <msbuild> 
            <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
            <workingDirectory>C:\Projects\Source\foo.SwsFall2011</workingDirectory>
            <projectFile>msbuild.xml</projectFile>
            <buildArgs>/noconsolelogger /p:Configuration=Dev;DeployOnBuild=true;DeployTarget=Package;PackageAsSingleFile=false /v:d "/l:ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll;C:\Projects\Artifacts\foo.SwsFall2011\msbuild-results.xml" </buildArgs>
            <targets>BuildCI;ConfigMerge</targets>
            <timeout>600</timeout>
        </msbuild>

Is there a way just to merge the web.configs into a set of config directories with a single task that doesn't do the entire build? Something like:

configs  
 \dev\web.config  
 \qa\web.config  
 \client-dev\web.config  

回答1:


The various web configs as per the functionality built in to visual studio only merge upon a publish. We have a post-build task to merge them upon build. Customize as you see fit. Realize the options are slim though - so don't shoot the messenger - this is just one way. There may be others, but nothing that I know of 'built in'

Visual studio 2010 - Per Developer/machine/environment Web.Config settings



来源:https://stackoverflow.com/questions/7590157/how-to-merge-all-web-configs-at-once-for-a-mvc3-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!