Visual Studio 2022 doesn't contain project, doesn't build a solution and doesn't create projects in the designated folder.

DyakovL 40 Reputation points
2023-01-24T19:46:55.81+00:00

Hello, I have just bought a new laptop and I have installed VS 2022 on Windows 11. However when I create a new Console Project for C# i can't see the .cs project, nor can i build it and when i click on "Attach" it oppens an "Attach to Process" window instead of building my solution. I tried to reinstall VS and do all the windows updates, however nothing I tried worked. I will attach two pictures for reference. VS2022 Problem.png VS2022 Problem 2.png

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,612 questions
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 25,706 Reputation points Microsoft Vendor
    2023-01-25T06:03:22.9366667+00:00

    Hi @DyakovL, 

    Welcome to Microsoft Q&A!

    Please check your System environment variables if there are two paths to dotnet.
    C:\Program Files\dotnet
    C:\Porgram Files (x86)\dotnet

    If so, please delete this one: C:\Porgram Files (x86)\dotnet.
    Then, restart your computer and check if the project can be created normally.

    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.

    20 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Michael Taylor 48,311 Reputation points
    2023-01-24T20:32:13.2766667+00:00

    You don't have any project open so none of the above will work. Notice in Solution Explorer that there is no C# project node. I'm not sure how you created your C# project but in Visual Studio do the following to create a project that you can run.

    1. Either start Visual Studio or, if it is already running, go to the File\Start Window menu.
    2. In the Start Window select Create a new project.
    3. In the project wizard either select a project template or type in the template name in search to find it. For a C# console app you can use Console App. Ensure that the tags include C#. Click Next. enter image description here
    4. In the new project dialog provide a project name (should be a valid C# name) and optionally change the path where the project would be stored. If you already have a solution open then it will default to adding the project to the open solution otherwise it will give you a default solution name that matches the project. Click Next. enter image description here
    5. In the next dialog you can leave the defaults which are most likely .NET 6.0. Click Create to create the project. enter image description here

    Notice the solution has a project node for C# under it and the C# source file(s) are under that. When you build the solution (or debug/run) then it'll compile (and run) all projects in the solution.

    When you close and reopen Visual Studio this new project should show up in the recent list so you can just open it from there.

    0 comments No comments