.NET 解决方案的哪些部分导致编译速度缓慢?

发布于 2024-12-08 15:44:45 字数 471 浏览 0 评论 0原文

我的雇主有一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

久伴你 2024-12-15 15:44:45

每次进行更改时都需要重建整个解决方案吗?重建当前项目就足够了吗?这可能会加快速度一点。

我正在开发一个包含近 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.

单身情人 2024-12-15 15:44:45

为了加快构建速度,请卸载您不处理的项目。在解决方案资源管理器中,右键单击项目并单击“卸载项目”。您可以选择多个项目并一次性全部卸载。当您构建时,不会构建已卸载的项目。

如果一个解决方案包含很多项目,那么您几乎肯定在任何给定时间只处理其中的几个项目。如果你同时处理所有这些问题,你需要审视一下你的工作方式。

这与从解决方案中删除项目不同。当您需要更改/重建已卸载的项目时,只需重新加载即可轻松完成。

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.

囚你心 2024-12-15 15:44:45

引用其他 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!

恋竹姑娘 2024-12-15 15:44:45
  • 如果您使用本地文件的源代码管理(例如 SVN),则值得在代码目录上禁用防病毒功能。
  • 复制到输出目录设置为不复制(如果无法执行此操作)使用如果较新则复制
  • 如果可能,请删除所有构建前/构建后事件
  • 如果您将 WebSite 项目切换到 WebApplication
  • 对于卸载和加载项目,您可以使用 解决方案负载管理器
  • If your are using source control with local files e.g. SVN it is worth to disable anti-virus on your code directory.
  • Set Copy to Output Directory to Do not copy if you cannot do that use Copy if newer
  • If possible remove all pre/post build events
  • If you have WebSite project switch to WebApplication
  • For unloading and loading projects you could use Solution Load Manager.
讽刺将军 2024-12-15 15:44:45

编译有时会受到磁盘限制,特别是对于 .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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文