Visual Studio 2022 stuck in Build
Asked Answered
M

2

9

I'm currently using VS2022 Community Edition and has updated it to the latest version (17.6.3). I updated to this version because whenever I launch a console application after the first run, the build is just stuck at "Building". It would require me to restart my machine before this would actually work. I can't even stop the build if not forcing task manager to stop the process.

I tried the following:

  • Deleting bin/obj folders
  • Uncheck code analysis in the project properties
  • Clean solution

I also tried opening the product in Rider but the result is the same. I am suspecting this might be a MSbuild issue but I don't know what causes this.

Console app: C#, .net 4.8

Metamorphosis answered 15/6, 2023 at 19:26 Comment(3)
Turn on Diagnostic-level MSBuild output logging under Tools > Options > Build and look at the build-logs in the Output window. Also, try using .NET 7+ instead of .NET Framework 4.8 as it has a different build system. Does it hang if you use .NET 7+ and build via running dotnet build from the command-line (instead of from within VS's Build button)?Selfidentity
The application is a legacy .net 4.8 app so I don't think I can build it with .net core.Metamorphosis
Right - I meant creating a quick toy program to verify that you can build those at least.Selfidentity
A
0

I met similar issue, now solved.

Possible reasons:

1.You installed Cascade Mono font or its similar fonts by some reason.

2.You installed Windows Terminal, while Windows Terminal installs Cascade Mono font automatically.

Windows Terminal is this guy below:

Windows Terminal

3.The Inlay Hints function in ReSharper makes it stuck.

The workaround of point 3 can be referred to:

Sergey Kuks's reply - youtrack.jetbrains.com (screen shots for settings in "ReSharper Options" inside.)

Then uninstall Windows Terminal, uninstall Cascade Mono font, check again.

Abbate answered 30/5 at 5:46 Comment(1)
I am no longer part of the company when I had this issue but surprisingly the context is correct. I have cascade mono, windows terminal, and resharper. that could have caused it but nonetheless, nice thing to know.Metamorphosis
P
0

In my case, I imported an existing project to use it in another solution. The old project had a StyleCop reference in the (SDK) project file. It was something like

<ItemGroup>
  AdditionalFiles Include="$(SolutionDir)\stylecop.json" Link="$(SolutionDir)\stylecop.json"
</ItemGroup>

Since the new project does not have the stylecop.json file, it caused the build to hang. If this is the case for you either

  • Delete the <AdditionalFiles> line in the new project OR
  • Copy the stylecop.json file from the old location to the new location.
Parisparish answered 26/8 at 9:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.