简体   繁体   中英

Different config settings for local visual studio build and local IIS build for .NET website projects

We have a fairly large .NET website (not web application) project, which, upon hitting a page on the site, takes about 3 minutes to build after any changes to App_Code or to DLL dependencies. By configuring the compilation settings to turn on optimizeCompilations and turn off Batching, we can get this down to 30 seconds. Which is awesome.

However, for some reason turning off the batching ( <compilation batch="false"/> ) seems to cause Visual Studio 2008 to compile much, much more slowly - going from 3 or so minutes to closer to 15. That's really not cool for making sure we don't break the build before check-ins, and also sucks since VS turns all our files read only during that time. This is slower for both compiling our class library projects and for validating the site (which in a website application doesn't actually do anything other than check that your pages should actually compile).

So my question is: Can I set compilation settings in a .config file somewhere that will only affect IIS, but not Visual Studio itself?

You should be able to use external config files for the <compilation> node as long as you have updated visual studio.

http://connect.microsoft.com/VisualStudio/feedback/details/312199/using-configsource-for-system-web-compilation-section-breaks-debugging-in-vs2008

So your web.config will look like this

<compilation configSource="compilation.config" />

And have a compilation.config file that is different on your dev box and IIS

<compilation debug="true" batch="false">
</compilation>

<compilation debug="false" batch="true">
</compilation>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM