Nicolas Rossi
Nicolas Rossi

Reputation: 123

Can't run program because it asks me to attach on process

I'm new to C# Programming, and instead of just letting me run the code by pressing F5, "Attach..." appears where the Run button should be and it won't let me run the code. This has happened me twice by now and I don't know how to make the "Run" button appear again, because I can't test any program I write.

Upvotes: 12

Views: 52454

Answers (7)

Rustam Rahimov
Rustam Rahimov

Reputation: 1

Uninstall .NET Framework: Go to "Control Panel" and navigate to "Programs" or "Programs and Features". Look for any entries related to .NET Framework or dotnet, and uninstall them. Make sure to uninstall all versions that are currently installed on your system.

Download the latest .NET Framework: Visit the official Microsoft website (https://dotnet.microsoft.com/download) and download the latest version of the .NET Framework that is compatible with your operating system.

Install the .NET Framework: Once the download is complete, run the installer and follow the on-screen instructions to install the .NET Framework on your system. Make sure to choose the appropriate options and configurations based on your requirements.

Restart your computer: After the installation is complete, restart your computer to ensure the changes take effect.

Upvotes: 0

Keckaroska Elena
Keckaroska Elena

Reputation: 21

I have x64 on my mashine and after installing Visual Studio I couldn't run the code same as you. I solved the issue by deleting this Path system's variable which is in System Properties > Advanced then Environment Variables at the bottom. Go to the System Variables, select Path and Edit. Then delete: "C:\Program Files (x86)\dotnet". The problem was that this path was used for reading dotnet folder instead of "C:\Program Files\dotnet".

Upvotes: 2

dota2pro
dota2pro

Reputation: 7856

In my case it was happening because I opened a blank project, when I switched to a Console App Template I could see the run Icon.

Upvotes: 0

mansoor ahmed
mansoor ahmed

Reputation: 1

Go to File > Add > Existing Project and select the one you want to execute.

Image

Upvotes: -1

Jaytt Corrêa
Jaytt Corrêa

Reputation: 29

Go to %appdata% and delete the Visual Studio folder, this will reset Visual Studio and fix this error.

Upvotes: -2

Marcin
Marcin

Reputation: 35

You probably used option recent files which is next to recent projects and solutions option. You still can use recent projects and solutions menu item. There is no bug here.

Upvotes: 0

LeBaptiste
LeBaptiste

Reputation: 1186

Make sure you have your solution opened, then right click on your project > Set as Start Up Project

Upvotes: 34

Related Questions