Visual Studio在构建过程中不断挂起 [英] Visual Studio hangs constantly during build

查看:107
本文介绍了Visual Studio在构建过程中不断挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大概在我构建解决方案的25%到50%之间,我会看到:



您请求的操作花费的时间比预期的要长。操作完成后,此对话框将关闭。



我讨厌我无法描述的窗口。它永远不会解决,永远不会启用取消按钮,并且解决该问题的唯一方法是终止devenv进程并再次加载我的整个解决方案,并且完全了解我没有修复任何问题,并且同样有责任看到



我的解决方案总共有大约60个项目,其中大多数是C#类库,每个项目都有一些Web应用程序,Web服务,和控制台应用程序。但是,即使在卸载了大部分项目(50)的情况下构建一部分代码库时,问题仍然存在。



我的问题是输出窗口无法显示在冻结的任何时候我都无法识别任何东西,而且我不知道如何确定锁定的原因。如果我猜测的话,我会认为这是文件系统中的一个死锁,但是我不知道如何证明这一点,更不用说如何防止它了。



我该怎么做才能从解决方案中诊断并消除它,从而使我再也看不到它了?通常,如何诊断在构建期间发生的问题?

解决方案

遇到类似问题,VS会挂起45或因此几秒钟,然后构建4秒钟并完成。挂起的45秒不会对GUI产生任何输出,而VS则挂起。



使用ProcMon,我可以通过devenv在/ packages /文件夹中看到300万个文件操作.exe何时构建此项目(以后将继续运行一段时间)!构建的第一步,您可以看到它正在检查每个软件包,以查看是否需要进行软件包还原(没有)



因为我倾向于指责NuGet适用于所有内容,我在 Visual Studio->选项-> Nuget Package Manager->常规下禁用了Nuget包还原允许NuGet下载丢失的包复选框。 令我高兴的是,构建速度非常快。总共5秒!



结果是,我们在启用构建时启用了程序包还原(我认为这在VS中是默认启用的),并且将软件包检入源代码管理。看来这会导致TFS发生某种变化……检查恢复包必须触发TFS进行一些源代码控制操作检查。



仅供参考,这是VS2013 UPDATE 4- Nuget版本:2.8.50926.663 ..在具有NumberOfProjects = 38的sln上,但是我可以重新构建此挂起,只需构建具有2个依赖项的单个csproj。



更新:



在Sln上使用SccNumberOfProjects = 53的本地主机全部重建是7:05的2分钟可视化工作室冻结/无响应




  • 在无冻结的2核i5上降至4:14

  • 在4核i7的i5上降至2:44
  • $ b


另外:这是一台装有各种文件监视程序安全性工具的计算机,可能没有为整个过程增加任何速度……而且可能是罪魁祸首。 p>

Probably between 25 and 50% of the times I build my solution, I see this:

"The operation you requested is taking longer than expected to complete. This dialog will close when the action completes."

I hate this window in ways I can't describe. It never resolves, the Cancel button is never enabled, and the only way to remedy it is to kill the devenv process and load up my entire solution again, knowing full well that I've fixed nothing and I'm equally liable to see the same thing when I attempt my build.

My solution is about 60 projects in total, which are mostly C# class libraries, with a few each of web applications, web services, and console applications. However, the problem persists even when building one slice of the codebase with the majority (50) of the projects unloaded.

My problem is that the output windows doesn't tell me anything at the point at which it freezes, and I don't know how else to determine the cause of this lockup. If I were to guess, I would assume that it's a deadlock in the filesystem or something, but I don't know how to go about proving this--much less how to prevent it.

What can I do to diagnose and eliminate this from my solution so that I never see it again? In general, how can I diagnose problems that occur during a build?

解决方案

Had a similar issue, VS would hang for 45 or so seconds then build for 4 seconds and complete. The 45 seconds of hang would not produce any output to GUI and VS would hang.

Using ProcMon i could see 3 million + file operations on the /packages/ folder via devenv.exe when i would build this project (and would continue for some time after)!! The first steps of the build you can see that it was checking EVERY PACKAGE to see if it needed to do a package restore (it did not)

Since I tend to blame NuGet for everything, I disabled Nuget Package Restore "allow NuGet to download missing packages" checkbox under Visual Studio -> Options -> Nuget Package Manager -> General. To my delight, the build was very fast. 5 seconds total!

Turns out that we had enable package restore on build enabled (i think this is on by default now in VS) AND we also had the packages checked into source control. It seems this causes TFS to thrash in some way ... checking for restoring package must trigger TFS to do some source control operation checks.

FYI this was VS2013 UPDATE 4 - Nuget version: 2.8.50926.663 .. on a sln with NumberOfProjects = 38 , but i could recreate this hang just building a single csproj with 2 dependencies.

Update:

Localhost "Rebuild All" on Sln with SccNumberOfProjects = 53 was taking 7:05 with 2 minutes of visual studio frozen / unresponsive

  • down to 4:14 on a 2 core i5 with no freezing
  • down to 2:44 on a 4 core i7

Also: This was on a machine with various file watcher security tools, likely not adding any speed to this whole process... and possibly to blame.

这篇关于Visual Studio在构建过程中不断挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆