Visual Studio 2022 - React - Debug options grayed out (previously working)

Richard Adams 15 Reputation points
2023-05-16T13:29:38.6633333+00:00

I have been developing a Typescript React App project in Visual Studio 2022 Professional for weeks with no issues.

Yesterday the debug options disappeared and it appears greyed out in the debug dropdown (See below). I tested other projects in the solution and the issue appeared to "spread" to them.

User's image

User's image

I have tried -

  • Restarting VS2022
  • Deleting the VS2022 .vs folder and opening the project again
  • Compared the Solution file for changes
  • Compared the Project file for changes
  • Checked the Debug settings with a working project
  • Repaired VS2022 and tried the above again
  • Pulling projects into a new solution

The unusual thing is that if I create a new Typescript React App project it will work for that new project.

Any ideas would be much appreciated. Would rather not move it all to a new project and mess up the git history.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,776 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
960 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Anna Xiu-MSFT 27,216 Reputation points Microsoft Vendor
    2023-05-17T07:04:07.21+00:00

    Hi @Richard Adams, 

    Welcome to Microsoft Q&A! 

    Do you mean the debug options disappear in existing projects but display in new projects? 

    Please go to Solution Explorer > right-click on project node > Set as Startup Project.

    Then, the debug menu may be displayed normally. 

    Or you can set multiple startup projects

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Richard Adams 15 Reputation points
    2023-05-22T08:13:25.87+00:00

    Still not resolved, any help much appreciated

    0 comments No comments

  3. Inchley Joseph 0 Reputation points
    2023-07-06T09:46:09.76+00:00

    I had a similar issue when working with my team. Turns out when committing to source control we had not committed .vscode/ as it looks like a runtime folder. We didn't realise the error as the folder is not shown by visual studio in the solution explorer.

    This is where visual studio keeps the debug steps for the project and it produces the exact same error described here, would also explain why it works on new projects.

    Try removing this from your ignore file and rebuild it from a template solution example :)

    0 comments No comments

  4. Naseer 0 Reputation points
    2023-12-23T07:33:25.23+00:00

    Hi Anna and Everyone,

    I have the same problem. What is the "Project Node"? Why is there a "Node"? And why do we have to do extra steps to turn on something that should be on by default?

    This is very frustrating for a beginner. It's like a car without an engine.

    I have right clicked on everything to find "Set as Startup Project" but I can't see it at all.

    I have VS2022, installed today 23rd of December 2023.

    0 comments No comments

  5. Naseer 0 Reputation points
    2023-12-23T07:34:12.1933333+00:00

    Never mind. I found the solution.

    There are 2 ways. I tried the one shown in the right of the image. There is a button with a play icon called "Select Startup Item". Use it to choose your .vcxproj file.

    the seconds way is to right click the .vcxproj and select the "set as startup item" as Anna had suggested. The debug buttons are not greyed out, but I got this error when I tried to run the very very simple code.

    User's image

    User's image

    0 comments No comments