How to fix debug in vs2022 C# Console App

Allas Martins 5 Reputation points
2023-03-17T14:09:34.1633333+00:00

Debug(F5) or run without debug(CTRL + 5) is not enable. How can I fix this. I use Visual studio 2022 and I can not debug my C# Console projets,
only enables the Attach to Process function. Please help me

User's image

Developer technologies | Visual Studio | Debugging
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,691 Reputation points Microsoft External Staff
    2023-03-22T09:54:08.12+00:00

    Hello @Allas Martins ,

    Welcome to Microsoft Q&A forum.

    Can you confirm that if your projects have been successfully loaded in VS? You can verify this by checking the Solution Explorer, if there’s no project/file listed in Solution Explorer, then probably your projects are not loaded correctly.

    If project didn’t load correctly, please first try to remove the hidden .vs folder in your solution folder(back up it before you remove it, just in case), and then right-click the .sln file > Open With > Microsoft Visual Studio 2022.

    Please also try to search Edit the system environment variables in Windows Search box > select and open it > click Environment Variables… > under System variables select Path > click Edit… > find C:\Program Files\dotnet\ and C:\Program Files (x86)\dotnet\ > Use Move Up and Move Down button on the right to make sure that C:\Program Files\dotnet\ lists before C:\Program Files (x86)\dotnet\ > reboot your machine and restart VS.

    If above suggestions don’t work, please try following:

      1. Repair and update VS from VS Installer.
    1. Reset VS settings(open Developer Command Prompt for VS 2022 XXX > run devenv /ResetSettings).

    Please feel free to let us know if it works.

    Sincerely,

    Tianyu


    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.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.