[英]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. 我们有一个相当大的.NET网站(不是Web应用程序)项目,当点击该页面上的页面时,在对App_Code或DLL依赖项进行任何更改后,大约需要3分钟的时间来构建。 By configuring the compilation settings to turn on optimizeCompilations and turn off Batching, we can get this down to 30 seconds.
通过配置编译设置以打开optimizeCompilations并关闭Batching,我们可以将其缩短到30秒。 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. 但是,由于某种原因,关闭批处理(
<compilation batch="false"/>
)似乎会使Visual Studio 2008的编译速度要慢得多,从3分钟左右缩短到15分钟左右。确保我们在签入之前不会破坏构建,并且由于VS会将所有文件在该时间段内只读,因此也很糟糕。 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? 所以我的问题是:是否可以在仅会影响IIS但不影响Visual Studio本身的.config文件中设置编译设置?
You should be able to use external config files for the <compilation>
node as long as you have updated visual studio. 只要您已更新Visual Studio,就应该能够将外部配置文件用于
<compilation>
节点。
http://connect.microsoft.com/VisualStudio/feedback/details/312199/using-configsource-for-system-web-compilation-section-breaks-debugging-in-vs2008 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 因此,您的web.config将如下所示
<compilation configSource="compilation.config" />
And have a compilation.config file that is different on your dev box and IIS 并在您的开发箱和IIS上使用一个compiling.config文件
<compilation debug="true" batch="false">
</compilation>
<compilation debug="false" batch="true">
</compilation>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.