can't run the basic console tutorial, can't run the program, Attach shows rather than program name

Ken Hackbarth 0 Reputation points
2024-02-22T22:29:20.9666667+00:00

Just installed VS 2022 and am trying to run the first tutorial - create a console app. When I launch VS 2022 I don't see the app name to the right of the green "play" icon. Instead I see the word "Attach". If I click on that I am presented with an "Attach to process" dialog and I have no idea what to do or why. I see the same behavior on two different Windows 11 computers after a fresh install of VS 2022 Version 17.9.1.

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

6 answers

Sort by: Most helpful
  1. Michael Taylor 53,896 Reputation points
    2024-02-22T22:53:44.7633333+00:00

    Did you open the solution? In order to run code in the debugger that you wrote you need to have that code in a project. Wrapping each project is a solution which is just a virtual collection of related projects. Once you have a project loaded in VS with your code in it then you can build that code using F8 and then run the code using F5.

    An easy way to tell if you have a solution open or not is the fact that the solution name is shown in the titlebar of VS. Additionally in Solution Explorer you'll see the solution node and under that your project node (console app). Under the project node is your source files that you can edit.

    enter image description here

    We don't know what tutorial you're referring to so please provide us a link to the steps you're following and ideally a screenshot or something so we can see what you're seeing.

    0 comments No comments

  2. Ken Hackbarth 0 Reputation points
    2024-02-22T23:18:53.84+00:00

    Here's the tutorial. I chose VB as the coding language. And here's what my screen looks like: IDE for console app

    Thanks, Ken


  3. Anna Xiu-MSFT 28,661 Reputation points Microsoft Vendor
    2024-02-23T02:38:43.0533333+00:00

    Hi @Ken Hackbarth, 

    Welcome to Microsoft Q&A! 

    Please search "Edit the system environment variables" in Windows Search box > Open it > Environment Variables… > System variables > select Path > Edit… > check if there are two paths to dotnet:

    C:\Program Files\dotnet

    C:\Porgram Files (x86)\dotnet 

    If you can find them, please click on the Move up button to move the entry C:\Program Files\dotnet before the x86 one. 

    Or delete this one: C:\Porgram Files (x86)\dotnet.  

    Then, re-launch the VS2022 and create a new project to check it again.  

    If it doesn’t work, please try to manually download and install the latest .NET SDK with 64-bit version

    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.  


  4. Ken Hackbarth 0 Reputation points
    2024-02-23T03:51:45.4466667+00:00

    I gave it a shot. First, I looked at my environmental variables and there was no entry for C:\Program Files\dotnet or C:\Program Files (x86)\dotnet. So I put the first one in and moved it above the reference to the tools directory. EV1

    relaunched VS and saw no change (still "Attach" next to Play button) I thought it might be the absolute path so I put %USERPROFILE% in place of C:\Program Files: EV2

    Restarted VS and no change. So I followed the link to install the latest .NET and here's what I saw at completion of the install: The installation was successful. The following products were installed: • .NET SDK 8.0.201 • .NET Runtime 8.0.2 • ASP.NET Core Runtime 8.0.2 • .NET Windows Desktop Runtime 8.0.2 Per instructions on the install page, I tested the install in the command window: C:\Users\ken>dotnet Usage: dotnet [options] Usage: dotnet [path-to-application] Options: -h|--help Display help. --info Display .NET information. --list-sdks Display the installed SDKs. --list-runtimes Display the installed runtimes. path-to-application: The path to an application .dll file to execute. Restarted VS and repeated the process. No change (other than lots of ConsoleApp solutions...): current state


  5. Ken Hackbarth 0 Reputation points
    2024-02-27T20:56:41.6733333+00:00

    I was able to install VS 2022 on a third PC and get the Console app to work. This PC has fewer applications installed - in particular it doesn't have NSB AppStudio and RemotePC installed. I don't know if either of these apps is in conflict with VS, but they're both more valuable to me right now than VS. So, rather than installing each on the third PC and seeing when/if the problem resurfaces, let me ask you, "What should I Attach to ?" Maybe I can get VS working on the first two PCs (even if just procedurally). Thanks, Ken

    0 comments No comments

Your answer

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