4

I have a problem with my Visual Studio 2022 and my Solution.

When I open my Visual Studio 2022, and Build the the entire solution my visual studio disable the button to build and show a message when you try to close : "The build must be stopped before the solution can be closed.".

Before the first Build:

After first Build:

When I try to close:

I opened VS with Administrator user.

In my solution I have projects dbml, WPF, C# and WCF.

This last one the WCF projects have a problem. Because when I Build another projects the problem don't happened. But when I build the WCF projects the problem happen.

My task manager show this process:

I tried close one by one to identify the process but i did find.

Only when I force close devenv.exe and open again Visual Studio the build option enable.

Can Someone help me please?

EDIT:

This bug was fixed in version 17.2.6 of Visual Studio 2022. Please if you have this error, please update Visual Studio 2022 to the last version.

https://developercommunity.visualstudio.com/t/Build-doesnt-interrupt-after-build-erro/10038753

https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes#1726--visual-studio-2022-version-1726

RosnelOn
  • 61
  • 2
  • 10
  • Maybe you can try using Ctrl+Break to stop the build, it will take some time. – Lan Huang Jun 07 '22 at 05:19
  • No, this is not a solution for me. Because i can close the visual studio with task manager of windows. – RosnelOn Jun 07 '22 at 16:38
  • Killing VS with task manager and restarting the job works, but doesn't conflict with trying Ctrl+Break.https://stackoverflow.com/questions/8997430/how-do-i-cancel-a-build-that-is-in-progress-in-visual-studio – Lan Huang Jun 08 '22 at 09:52
  • @LanHuang, Yes, close and open VS work. But i can't close and open VS every time that I need Build my solution. It is very stressful. – RosnelOn Jun 09 '22 at 04:59
  • So have you tried the Ctrl+Break method when you can't close VS? Ctrl+Break is used to cancel/stop a build currently in progress. – Lan Huang Jun 10 '22 at 05:34
  • I'm having the same issue now... this started after I updated VS and it said it will remove .Net 5.0, no idea if that messed VS up – ullfindsmit Jun 27 '22 at 02:49
  • @LanHuang , laptops don't have the 'Break' key. I tried pressing all (Ctrl+Fn+F1-12). Safe to say that it didn't work. I think this is a bug on Microsoft's part in one of their recent patch releases of VS 2022. – Krishnan Jul 06 '22 at 14:34
  • If it helps... I've noticed this happens only for "Build Solution" failures. Doesn't get stuck if you only "Build project" (any project type - library, console app, web app, old websites without csproj). – Krishnan Jul 06 '22 at 14:36
  • @ullfindsmit I try to add again .Net 5.0 and don't work yet. I installed almost all the features of visual studio 2022 and my problem did resolve yet. – RosnelOn Jul 08 '22 at 03:11

4 Answers4

6

You can use the Cancel command in the Build menu, which is the same as pressing CTRL+BREAK.

Build menu > Cancel

Rob Vaughan
  • 81
  • 1
  • 5
1

This bug was fixed in version 17.2.6 of Visual Studio 2022. Please if you have this error, update Visual Studio 2022 to the last version.

https://developercommunity.visualstudio.com/t/Build-doesnt-interrupt-after-build-erro/10038753

https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes#1726--visual-studio-2022-version-1726

RosnelOn
  • 61
  • 2
  • 10
0

Found this bug report in Visual Studio Developer Community Forum. https://developercommunity.visualstudio.com/t/ASPNET-project-Web-Forms-Build-never/10041947

It says that this bug has been fixed and slated for a future release. It also points to another bug report for a workaround.

Until the fix becomes available, here is a workaround that can be used to unblock this scenario:

  1. Install the Feature Flags extension.
  2. From Main Menu -> Tools -> Options -> Feature Flags - check the item "Solution.Services.UseLegacy"
  3. Press Ok and restart Visual Studio.

Another option is to update the value [$RootKey$\FeatureFlags\Solution\Services\UseLegacy] from Microsoft.VisualStudio.FeatureFlags.pkgdef and run devenv /UpdateConfiguration - as described in the discussion above.

Krishnan
  • 1,464
  • 15
  • 21
  • I should add that this workaround worked for me. – Krishnan Jul 08 '22 at 18:17
  • I try this but didn't work for me and worked a littlie bit. This workaround fix build the WCF project, I can build many times after the change, but when I try do right-click in the solution to build entire solution, Visual Studio 2022 crash. Event Viewer log: `Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException at System.String.wcslen(Char*) at System.String.CtorCharPtr(Char*) at System.Runtime.InteropServices.Marshal.PtrToStringUni(IntPtr) at System.W` – RosnelOn Jul 09 '22 at 05:12
  • hmm ok. VS 2022 17.2.6 has been released, which supposedly resolves this issues. Have a look. I'll update my answer shortly. – Krishnan Jul 13 '22 at 20:32
  • oh I see you have done that already. cool – Krishnan Jul 13 '22 at 20:33
0

If you can't find the Break key for the Ctrl+Break method, look for the Pause Break or Pause key. If this is accessible by the Fn key, try Ctrl+Fn+Pause/Pause Break.

AJP
  • 47
  • 11