"Error while trying to run project: Unable to start program". Can run program only once. Then VS needs restart

15,956

Solution 1

I had an issue similar to this and I had to clear the component cache instruction can be found Here.

Hope this helps.

Solution 2

For my case, it cause by Platform target, you could force choose it to x86 or x64 which your project is:

Each Project's Properties > Build > Platform target

Solution 3

As I pointed out also here, the only solution that worked for me was to disable the ConEmu integration:

ConEmu → Settings → Integration → Default term → disable Force ConEmu as default terminal for console applications

Some users reported that it was enough for them to disable the Aggressive mode in that same settings tab; that wasn't the case for me though.

Solution 4

The topic is old, but this might help someone else.

So in my case I made a file in Visual Studio with .cp extension (accidentally deleted the last 'p') this made visual studio just "include" the the file and not mark it as a compilation unit, thus not compiling it, I looked the *.vcxproj file in a text editor and found out about this, so if you open the project file in a notepad or something just find your file at the bottom usually and change from <Item .../> to <ClCompile .../>

Share:
15,956
tzippy
Author by

tzippy

Updated on June 21, 2022

Comments

  • tzippy
    tzippy almost 2 years

    I'm running my .NET 4.0 (C#) project in debug mode after I start VS2013. It runs just fine.

    The second time I start it from VS, I get the Dialog box that says "Error while trying to run project: Unable to start program C:\path\to\file.exe"

    The process is still alive in the Taskmanager when I dismiss the dialog box. From Windows Explorer, I can run the program just fine. And after closing it, the process is gone too from the Task Manager.

    A rebuild doesn't help. Is this a common problem with a known solution?