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?
I had an issue similar to this and I had to clear the component cache instruction can be found Here.
Hope this helps.
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
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.
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 .../>
I was getting similar errors. I just had to restart visual studio. Sometime couple times a day.
I had a similar error and resolved it by cleaning the solution. Right-click the solution name in Solution Explorer and choose Clean Solution.
I found a solution here:
Please check "Use Managed Compatibility Mode" under Tools|->Options->Debugging->General.
I'm Brazilian, I don't speak English very well. I did this translation on google translator.
I know the topic is old, but it can still help someone.
I had this same problem in the following situation, I have a dual boot computer (linux debian 11 and windows 10). Inside debian, on my NTFS D disk, I created a folder to perform programming tests. After accessing that same folder with windows, I created a new project in visual studio inside that same folder that I had created in linux. The creation of the project went without problems, however when I tried to run the project (F5), I received the same error from this topic. I tried all the solutions I found on the internet, and nothing worked. I gave all permissions to my admin user and it still didn't work. Then I realized that even going straight to the folder where the application's executable was and clicking directly on it, I still received the access denied error message. So, I took the project out of the folder I had created in linux, and it worked. So, what I could conclude, is that because the folder where my project was was created in linux, for some reason, my windows didn't trust this folder, so it didn't allow running executables from inside that folder, even this one executable having been created by visual studio from within windows.
Just simply create a folder name as "projects" in c drive and copy paste the newly created project in it. Run the project by doing clean & Build or Rebuild method . It will work
open the folder which contains the solution in visual studio.
again, open your *.sln file by double clicking it inside the solution explore once opened try running the solution or rebuild the solution. once rebuild gets completed, it will open without error from next time.
My way of solving the error : error while trying to load project : Unable to start program and c:\Path\to\file.exe was simply by
First restart Visual Studio
Click the build icon
Select the rebuild option
Run the Program or Debug the Program
This was a weird one. Going to put what happened to me here because it might happen to someone else. Everything was fine with the app until suddenly after some fairly insignificant code changes I suddenly started getting this error. Visual Studio was compiling the executable just fine. But, the moment I tried to run it (either from Visual Studio or directly) the executable file would be automatically deleted right out of the Debug folder. Super odd--never seen anything like it. I began to get suspicious that perhaps an anti-virus or the OS was somehow identifying a checksum or some signature in the executable as "dangerous". Or perhaps some obscure compilation bug was corrupting the executable. So on a hunch I made another innocuous change (added a couple of lines of code to color code some text in a rich text box) and the problem went away.
So i'm a programmer who's making a game on visual studio. I save my game on a USB so i can take it everywhere. Unfortunately, i left my USB in my home and when i booted up my PC, it did a scan and repair on my USB (drive (i)). so ,when I tried to open my game it failed and when i looked in the folder, it showed a file called FOUND.000, and my actual folder that had my project in was converted into a file.
I really unsure about what to do. i just want to know if there anything or anyway to restore the .CHK files into normal files
I think John is right I had the similar problem a few months ago and this solution has worked for me, all of my files were hidden after an antivirus scan and this made them visible.
http://visihow.com/Show_Hidden_Files_Using_Command_Prompt
Edit: following the instructions here "might" help you restore your data:
https://www.howtogeek.com/282798/what-are-the-found000-folder-and-file0000chk-file-in-windows/
My Program.cs file was working fine this afternoon. I closed Visual Studio (VS2013 Express) and shut down my computer. Then this evening I turned the computer on again and Program.cs now looks like this:
f£óö'ûRÏ>•]|êêlÇPš—·õGÉ+s
qÖY®ÓÇNŽ9¯€8ï,? óQwÕ®Åy„Ùrsb^ ƒoÏEl?Qäº6z¹ Ü -³‡kwÎR®Q| €s᪠å²!dKË*:ÀyÉÿ?l
Ã&Š‚Ëð.Š›ï,²©“Óü#q:VªÐMãҟ岂¡ËÀÌ<öò§-ž‹66‚j$+”tVeÃÛSVÿ Ïr£pÉ'äûèk0Iœ¾Y/HÅ;vþ
DãjÊÕIÿóõ‘>¤¶ËLw¬,‚ÓHï’$t‡³Ywõ2ŽHíg3É·HVß{fÄèÄKõ™>§ïä ŽíC}r^— x èd’—X÷§º~qXPk#
etc.
Any ideas on how to recover it? I tried running Recuva, but that didn't work. There is no copy in the Backup Files folder for this project.
EDIT: I've confirmed that this is happening every time I exit VS2013 and then re-open any project. I was able to use dotPeek to recover the file by decompiling the project's .EXE. However, the file decompiles in a format that requires substantial editing in order to do more work on it, e.g.,
xlApp=new Excel.Application()
becomes
Program.xlApp = (Application) Activator.CreateInstance(Marshal.GetTypeFromCLSID(new Guid("00024500-0000-0000-C000-000000000046")));
I need a more practical long-term solution than repeated decompilation. I'll get started with source control, but I'd ideally like to fix whatever problem is causing VS2013 to corrupt the file.
EDIT: This is now happening with other files, in the same project and in other projects in the same solution. In reference to EBrown's comment about encoding, I checked the encoding and the affected files are in "Unicode (UTF-8 with signature) - Codepage 65001" (as are the unaffected files). I am able to restore to the last committed version using git checkout HEAD, but this issue is making my work very inconvenient. I'm hoping to find a solution other than reinstalling VS2013.
When I am trying to debug (F5) in visual studio the compile hits 100% and sits there and takes forever to start my program that I want to debug. Also when the program does start it takes just as long for the program to close and the Visual Studio to start responding. Does anyone know why this happens?
Project is C# wpf, I use to have a silverlight project that did the same thing. I moved all the code to a new project and now my silverlight project works better now.
No special debug option, the same options that come with a new project.
The project is on the local C drive hooked up to TFS 2010.
No Static Analysis or ReSharper that I know of.
My Solution has 14 projects in it. 1 wpf and the rest are dll's and tool exe's.
No Anti-malware, and I disabled antivirus just to make sure it wasn't eating my lunch.
I unplugged my network cable and that did not help any of the network timeouts.
Disable any symbol servers Did not help.
I have found out that if you delete the .SUO file that things get fast it has been removed. It is next to your .sln file. My .suo file was 4.5 mb.
From Google all I can find is that the .suo file is some kind of user settings file but doesn't seem to do any harm when deleted, it just gets recreated.
Found that when doing an import on settings you can get your .suo file to go up in size... the size of the .suo file might not be the issue however a corrupted one might be the issue. I imported setting and made my .suo file go up to 5.7mb and my compile works ok, I deleted it however again because I don't want it to get corrupted.
At seemingly random times, whenever I load up VC# Express for the day and start working, any changes I make to my code don't get reflected in my debug runs. It's as if VC just refuses to compile the code and just runs the old already-compiled version. Deleting the "bin" folder in the project directory doesn't help, as then VC just complains that it can't find the *.exe instead of recompiling. Doing a rebuild helps, but only for that one rebuild, so I'm continuously having to rebuild the solution to see any changes, which is really slow.
The only way I've found to get rid of this problem (for maybe a week or two) is to create a new project and manually copy over my code. Needless to say, this is really frustrating and tedious. Is this a documented issue? What can be done to fix it? Searching online doesn't really turn up any answers, as the search terms most applicable to the problem bring up a lot of noise results.
You might see if the project you are working on is set to Build when the solution builds. To check this, right-click your Solution and go to Properties. Click the Configuration Properties node on the left and make sure all of the projects you want to build are checked on the ride side for your given build type.
UPDATE: Also, what is the timestamp on your build files? Is the timestamp getting updated on your build?
I had this problem when working on a network drive, and the time on the server was out of sync. Linux+Samba accessed by Win7 Pro and VB 2010 Express.
Correcting the time-difference solved the issue.
click on BUILD-->REBUILD SOLUTION and you are now good to go