简体   繁体   English

.NET网站项目的本地Visual Studio构建和本地IIS构建的不同配置设置

[英]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.

相关问题 Visual Studio将我的本地IIS网站配置为ASP.NET网站 - Visual Studio configures my local IIS website as an ASP.NET website 使用 MSBuild 构建 ASP.Net 网站与 Visual Studio 构建不同 - Build ASP.Net Website with MSBuild is different from Visual Studio build 如何使用 .NET 框架和 .NET 标准项目构建 Visual Studio 解决方案? - How to build Visual Studio solution with .NET Framework and .NET Standard projects? 在Visual Studio 2013中以不同版本在ASP.NET Web表单中更改Web.config - Web.config change in asp.net web form in different build in visual studio 2013 在本地IIS上运行ASP.NET网站 - Run ASP.NET website on local IIS IIS中对asp.net本地网站的权限 - permissions in IIS for asp.net local website 在Visual Studio 2017 Professional中使用发布设置进行构建 - Build with the Release settings In Visual Studio 2017 Professional Visual Studio-ASP网站-本地IIS-工作区名称是否可以包含在项目URL中 - Visual Studio - ASP Website - Local IIS - Can the workspace name be included in the project URL 生成的Visual Studio 2008 XDT(配置转换) - Visual Studio 2008 XDT (Config Transform) on build Visual Studio IIS Express 在启动时挂起,但 IIS 本地工作,为什么? - Visual Studio IIS Express hangs on launch, but IIS local works, why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM