.NET 解决方案的哪些部分导致编译速度缓慢?
我的雇主有一个包含 14 个项目的解决方案,巧合的是,编译整个应用程序只需要 14 秒。这使得更改和重新编译变得困难——浪费了大量时间。我可以在 .NET 应用程序中寻找哪些东西来加快编译速度?或者我可以问一下,什么工具最适合解决此类问题。 (查看 msbuild.exe 发生的情况)
解决方案详细信息:
- 强类型数据集和 Reporting Services
- WCF 服务
- C# 和 VB.NET 项目的组合
- 一个 Web 应用程序项目
- 资源(resx 文件)遍布各处
- 企业库(如果您需要,我可以提供具体信息)
- 用于向导导航的 Microsoft UIProcess 应用程序块
- Microsoft AJAX 控制工具包
- PdfSharp
请询问您是否需要更多详细信息。
My employer has a solution with 14 projects, and coincidentally, it takes precisely 14 seconds to compile the entire application. This makes it difficult to make changes and re-compile--lots of wasted time. What are things in a .NET application I can look for to make compilation quicker? Or may I ask, what tools are the best to troubleshoot this sort of thing. (To see what's happening with msbuild.exe)
Solution Details:
- strongly typed datasets w/ Reporting Services
- WCF services
- combination of C# and VB.NET projects
- one web application project
- resources (resx files) all over the place
- Enterprise Library (I can get specific if you need me to)
- Microsoft's UIProcess application block for wizard navigation
- Microsoft AJAX Control Toolkit
- PdfSharp
Please ask if you need more details.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
每次进行更改时都需要重建整个解决方案吗?重建当前项目就足够了吗?这可能会加快速度一点。
我正在开发一个包含近 300 个独立项目的解决方案,大约需要 2 分钟才能完成完整构建,但当我工作时,我只构建我当前正在处理的项目,从而节省了大量时间。
Do you need to rebuild the entire solution every time you make a change? Would rebuilding the current project be enough? that might speed things up a bit.
I work on a solution that has almost 300 separate projects, and takes about 2 minutes to do a full build, but when i am working i only build the project i am currently working on, saves a lot of time.
为了加快构建速度,请卸载您不处理的项目。在解决方案资源管理器中,右键单击项目并单击“卸载项目”。您可以选择多个项目并一次性全部卸载。当您构建时,不会构建已卸载的项目。
如果一个解决方案包含很多项目,那么您几乎肯定在任何给定时间只处理其中的几个项目。如果你同时处理所有这些问题,你需要审视一下你的工作方式。
这与从解决方案中删除项目不同。当您需要更改/重建已卸载的项目时,只需重新加载即可轻松完成。
To speed up building, unload the projects you're not working on. In the Solution Explorer, right click a project and click "Unload Project". You can select multiple projects and unload them all at once. When you build, unloaded projects will not be built.
If a solution contains a lot of projects, you're almost certainly only working on a few of them at any given time. If you're working on them all at once, you need to take a look at the way you work.
This is not the same as removing the project from the solution. When you need to change/rebuild an unloaded project, it's easily to simply reload it.
引用其他 VS 项目时,请确保将“copy local”设置为 false,除非出于特定原因需要它。
您可以针对您正在处理的项目创建另一个解决方案。
不过时间也不长了!
When referencing other VS projects, ensure you have "copy local" set to false unless you require it for a specific reason.
You could create another solution specific to the projects that you are working on.
It's not a long time though!
编译有时会受到磁盘限制,特别是对于 .Net 应用程序。在固态硬盘上速度会更快。如果您想测试这个理论,请将代码放入 RAM 磁盘 并编译它。
Compilation is sometimes disk bound, especially for .Net applications. It will go faster on a solid state drive. If you want to test this theory, put your code into RAM disk and compile it.