.net Visual Studio 在构建时挂起

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/371551/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 10:50:30  来源:igfitidea点击:

Visual Studio hangs on build

.netvisual-studio

提问by weiran

When I try to build my projects in Visual Studio 2008, web sites won't build anymore, they hang on this stage:

当我尝试在 Visual Studio 2008 中构建我的项目时,网站将不再构建,它们挂在这个阶段:

------ Build started: Project: C:\...\Web\, Configuration: Debug Any CPU ------
Validating Web Site
Building directory '/Web/Admin/Secure/'.
Building directory '/Web/Admin/'.
Building directory '/Web/Students/'.
Building directory '/Web/'.

Validation Complete

And I have to cancel it as it doesn't complete even after leaving it for an hour. Does anyone have any ideas on what's going on? Class libraries build fine.

而且我必须取消它,因为即使在离开它一个小时后它也没有完成。有没有人对正在发生的事情有任何想法?类库构建良好。

采纳答案by Brian Rudolph

This can also often happen in the event that you have a 3rd party control that is not licensed\registered properly. It may be attempting to display a warning\registration UI that is not making it to focus. We have had this issue on our build servers alot.

如果您的第 3 方控件未正确许可\注册,也经常会发生这种情况。它可能试图显示未使其成为焦点的警告\注册 UI。我们在构建服务器上经常遇到这个问题。

回答by NikolaiDante

Try clearing out all the temporary files in

尝试清除所有临时文件

C:\WINDOWS\Microsoft.NET\Framework\<Framework Version>\Temporary ASP.NET Files

This has solved similar issues for me in the past.

这在过去为我解决了类似的问题。

回答by Joseph Ferris

I have also run into this problem in the past. I was able to correct it by going to Build -> Clean Solution.

我过去也遇到过这个问题。我可以通过转到 Build -> Clean Solution 来纠正它。

回答by qui

I have had a similar problem problem before.

我以前遇到过类似的问题。

I fixed it by making a new solution file and adding the projects again - it might be worth giving that a go.

我通过创建一个新的解决方案文件并再次添加项目来修复它 - 可能值得一试。

回答by Keidrickp

renaming or deleting the SUO file seems to be a fix for this issue. My SUO file was 8mb, once I renamed and open my project back up, it ran without any crashing.

重命名或删除 SUO 文件似乎可以解决此问题。我的 SUO 文件是 8mb,一旦我重命名并重新打开我的项目,它就可以运行而没有任何崩溃。

回答by Dmitriy Dokshin

Restart your system. It helped me.

重新启动系统。它帮助了我。

回答by slasky

I know it's an old thread, but I just had this problem in Visual Studio Community 2013 (Update 5). Thought I would share what worked for me.

我知道这是一个旧线程,但我刚刚在 Visual Studio Community 2013(更新 5)中遇到了这个问题。以为我会分享对我有用的东西。

I cleared the checkbox for "Enable Code Analysis" in the Project Properties Pages, clicked OK, clicked save-all. Build completed at normal speed after this.

我清除了项目属性页面中“启用代码分析”的复选框,单击“确定”,单击“全部保存”。在此之后,构建以正常速度完成。

The code analysis seemed to be hanging during the Building Directory stage.

代码分析似乎在构建目录阶段挂起。

Hope this helps someone!

希望这可以帮助某人!

回答by Nathan

I just had the same problem. Turns out it was with a User Control I created to be transparent. While I was figuring it out, I accidentally had it invalidating the form from the control's OnPaint method, resulting in an infinite loop of painting. VS would never even start building if that control was present in any of the open designers, though it would lock everything out as if it were building. I couldn't update the designers with a fixed control because the control wouldn't build.

我只是遇到了同样的问题。原来是我创建的一个用户控件是透明的。在我弄清楚的时候,我不小心让它从控件的 OnPaint 方法中使表单无效,从而导致了无限循环的绘画。如果任何开放式设计器中存在该控件,VS 甚至永远不会开始构建,尽管它会像构建一样将所有内容锁定。我无法使用固定控件更新设计器,因为该控件无法构建。

My Answer: Take out the painting loop, close the designers, rebuild.

我的答案:取出绘画循环,关闭设计师,重建。

Oh, designer...

哦,设计师...

回答by Harry

If your .suo file has gotten too big, you may try to delete/move/rename it. VS will create a new version on your next build.

如果您的 .suo 文件太大,您可以尝试删除/移动/重命名它。VS 将在您的下一次构建中创建一个新版本。

回答by Merill Fernando

If you're a SharePoint developer, and have installed SPDisposeCheck, make sure that 'Execute after build' is switched off.

如果您是 SharePoint 开发人员并已安装 SPDisposeCheck,请确保关闭“构建后执行”。

enter image description here

enter image description here