Visual Studio deleting .exe files in \Debug\ folder.

In summary, the programmer is having trouble with their project and Visual Studio 2010 deleting the project.exe file. They have confirmed that files are being sent to the right place and have tried different things to fix the problem, but to no avail. They suggest trying to set the project's attribute to read-only and see if that solves the problem.
  • #1
Mholnic-
43
0
(Programming and VS newb here.)

I'm hoping someone has had (and fixed!) this problem. I'm working on a project for my CS-150 class but I'm having some tech troubles. I'm running Visual Studio 2010 Ultimate (downloaded via MSDNAA) and it (or something else) seems to be deleting my project.exe files.

When I hit Debug, it runs through to the end and then gives me the following:
"Unable to start program C:\Users\Admin\Documents\Visual Studio 2010\Projects\projectname\Debug\projectname.exe" "The system cannot find the file specified."

I go to the location and sure enough, the exe file is gone. But it was there before. I've been getting this error since I downloaded it, and have gotten into the habit of confirming the exe file's existence after the first debug. It'll work fine for a bit and then *poof* the .exe disappears. I have no idea where it goes, or how to get it back. I'm essentially being forced to delete my project and make several new ones until the exe file returns.. and then it'll disappear again.

Here is an example of a working file, with the .exe still in it:
C:\Users\Admin\Documents\Visual Studio 2010\Projects\OneLastTry\Debug\OneLastTry.exe

And a file that WAS working but no longer has the .exe:
C:\Users\Admin\Documents\Visual Studio 2010\Projects\Lab2Prj\Debug

I can't see a difference in the three, short of the fact that only one has the executable that it should. I've double and triple-checked to be sure that files are being sent to the right place, but to no avail. Has anyone had this problem, or know how to fix it? I obviously don't know enough about the program to know what it's doing to my files. xD
 
Technology news on Phys.org
  • #2
After creating the .exe file, try setting the attribute to read-only and perhaps system. Hopefully that will cause the system to prompt you when there's an attempt to delete the .exe.
 

1. Why is Visual Studio deleting .exe files in the \Debug\ folder?

Visual Studio has a feature called "Clean Solution" which deletes all intermediate and output files in the \Debug\ folder. This is done to ensure that the build process starts with a clean slate, avoiding any conflicts or errors from previous builds.

2. Can I prevent Visual Studio from deleting .exe files in the \Debug\ folder?

Yes, you can disable the "Clean Solution" feature by unchecking the "Build" option under "Clean Solution" in the Visual Studio settings. However, it is recommended to keep this feature enabled for a smooth and error-free build process.

3. Will my project still run if the .exe file is deleted from the \Debug\ folder?

No, in order to run your project, you need the .exe file in the \Debug\ folder. If it is deleted, you will need to rebuild your project to generate a new .exe file.

4. Can I recover a deleted .exe file from the \Debug\ folder?

If you have not built your project again after the .exe file was deleted, you can recover it from the recycle bin. However, if you have built your project again, the previous .exe file will be overwritten and cannot be recovered.

5. Is it safe to manually delete .exe files from the \Debug\ folder?

Yes, it is safe to manually delete .exe files from the \Debug\ folder. However, if you do not want Visual Studio to delete these files, you can disable the "Clean Solution" feature as mentioned in the answer to question 2. It is also recommended to clean your solution before deleting any files to avoid any errors in your build process.

Similar threads

  • Programming and Computer Science
Replies
0
Views
217
  • Programming and Computer Science
Replies
2
Views
283
  • Programming and Computer Science
Replies
3
Views
667
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
1
Views
235
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
9
Views
852
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
14
Views
1K
  • Programming and Computer Science
Replies
4
Views
5K
Back
Top