-1

I created a WinForms application project. The simplest one. When I hit ctrl + F5 nothing happens, and Visual Studio freezes. And sometimes I get this error: (Unable to copy file "obj\Debug\Project1.exe" to "bin\Debug\Project1.exe". The process cannot access the file 'bin\Debug\Project1.exe' because it is being used by another process.) But often output window is absolutely empty.

When I start it in debugging (F5) mode it works. It never happened to me before.

I checked Task Manager and it seems that the applicatin process is already started when the project is opened in VS and when I try to run the application another process is created. So, in that moment I have two identical processes. Maybe there lies the problem, but not sure. How to solve this?

Archiorg
  • 41
  • 1
  • 6

5 Answers5

3

Thanks to Zorgatone's answer (which is in the comments), in my case, the solution was to disable Avast antivirus.

Archiorg
  • 41
  • 1
  • 6
0

Possibly a registry file is missing? Have you cleaned registry's recently? Try start it in Compatibility settings to one lower than your current OP should temp fix it. The task manager process not being there is because it has services that run alongside it, identify and shut the related ones.

Doug
  • 1
0

Your system files may by corrupted. Try to run sfc https://support.microsoft.com/en-us/kb/929833

Siewier
  • 1
  • 2
0

From the toolbars, open the output console and watch while the libraries are being loaded and check when the problem occures. Also paste the output log.

Gnqz
  • 3,292
  • 3
  • 25
  • 35
0

I have faced this problem of "being used" etc. In my case, yes, the project was already running or the exe was running. I just had to close or end the one that was running (or close Visual Studio) and start again. I found it strange too. I guess, in the debug mode, VS kinda tries to write the exe in a temporary way to run it and if there is an exe already present in the debug folder, this error is thrown.

Whirl Mind
  • 884
  • 1
  • 9
  • 18