Visual Studio 2017 hangs while loading a solution

为君一笑 提交于 2020-01-06 06:44:56

问题


I have a solution containing 4 projects.

  • One .NET Framework project (Ananas)
  • Two .NET Core project (Bananas & Cherries)
  • One Xamarin project (Dewberries)

Every time I start Visual Studio 2017 Community (15.6.2) and load the solution, it hangs itself while loading in the first project (Ananas).

I can sit and wait for it to load for 30 minutes or more, but the progress bar will just keep animating. I have to totally kill Visual Studio to stop this.

If I then delete the solution folder, and unpack it anew from a backup archive that I have stashed away and load it up again, it loads the first time without hanging. But when I close the solution, close Visual Studio, restart and load it again, it starts to hang again.


回答1:


Try opening Visual Studio in Administrator Mode.




回答2:


There are lots of different guids in the Visual Studio solution files.

As per my comment to @samirg's answer:

The first Guid Project("{ <GUID> }") is the .net project type, the second Guid ".csproj", "{ <GUID> }" is the unique project identifier. You should not change the first, but you can set the second to a unique ID.

Visual studio generates both, the first from the project type you select when creating a new project, the second uniquely identifies that project.

It appears you have a mix of both new and old project guids as seen here in the .net Project System repo README.md

https://github.com/dotnet/project-system/blob/master/docs/opening-with-new-project-system.md

The project type guid (at this point now that there are 2 for each language) tells Visual Studio to treat the project like an old or new project type.

FAE04EC0-301F-11D3-BF4B-00C04F79EFBC is the old C# project guid.

9A19103F-16F7-4668-BE54-9A1E7A4F7556 is the new C# project guid.

Since you have a mix of both I would change all of the old guids to the new ones for consistency in the behavior of the solution.

The new VS2017 project system has a bunch of benefits.




回答3:


If you inspect the Solution (SLN) file, you may find duplicate GUIDs for two or more of the projects. See the example below.

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ananas", "Ananas\Ananas.csproj", "{F16C0F09-8509-4370-B4FF-C6E1C1C27C31}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bananas", "Bananas\Bananas.csproj", "{9D7771AE-8A04-438E-858A-7DBD42025BF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cherries", "Cherries\Cherries.csproj", "{91FB0CB7-5DC1-4B86-B33C-F22BE6A11CF2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dewberries", "Dewberries\Dewberries.csproj", "{424ABA82-B745-4376-8A52-632B9016608E}"
EndProject

As you can see the first and the last project have the same GUID, and the two projects in the middle have the same GUID as well. What you need to do is generate a valid GUID to differentiate the conflicting projects. Such that, you get something like the following.

Project("{2CD1389C-9B3D-41E9-9AC4-FB6402671C81}") = "Ananas", "Ananas\Ananas.csproj", "{F16C0F09-8509-4370-B4FF-C6E1C1C27C31}"
EndProject
Project("{73ED998E-CD14-48E9-8193-A60F496F9CD7}") = "Bananas", "Bananas\Bananas.csproj", "{9D7771AE-8A04-438E-858A-7DBD42025BF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cherries", "Cherries\Cherries.csproj", "{91FB0CB7-5DC1-4B86-B33C-F22BE6A11CF2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dewberries", "Dewberries\Dewberries.csproj", "{424ABA82-B745-4376-8A52-632B9016608E}"
EndProject

To generate valid GUIDs, I suggest that you use an online tool for this, such as Online GUID Generator.



来源:https://stackoverflow.com/questions/49374422/visual-studio-2017-hangs-while-loading-a-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!