Error: Access to Debug bin file

Asked

Viewed 1,171 times

1

I’m watching some video lessons on Youtube about C# but there’s one in question that I can’t solve at first.

The C# code I am using is exactly this below:

using System;

namespace IniciandoProjeto
  {
     class Principal
     {
        static void Main(string[] args)

           {
               Console.WriteLine("Hello World");
               Console.ReadKey();
           }
      }
  }

I’m using the CTRL+F5 to see what happens on the screen, but does not execute. And if I use only the F5 is the black screen, only.

The mistakes that come to me are these:

Warning 10  Could not copy "obj\Debug\AprendendoVideoAula1.exe" to "bin\Debug\AprendendoVideoAula1.exe". Beginning retry 10 in 1000ms. The process  cannot access the file 'bin\Debug\AprendendoVideoAula1.exe' because it is being used by another process.    AprendendoVideoAula1

   Error    11  Could not copy "obj\Debug\AprendendoVideoAula1.exe" to "bin\Debug\AprendendoVideoAula1.exe". Exceeded retry count of 10. Failed.    AprendendoVideoAula1

   Error    12  Unable to copy file "obj\Debug\AprendendoVideoAula1.exe" to "bin\Debug\AprendendoVideoAula1.exe". The process cannot access the file 'bin\Debug\AprendendoVideoAula1.exe' because it is being used by another process.  AprendendoVideoAula1
  • 1

    You probably have an instance of your executable running, and with that the OS does not let the compiler overwrite the file. Close all instances of your program, and try again.

  • 1

    It is running the file outside of Visual Studio... when it tries to run by VS, it gives the error indicating the path. See, as @carlosfigueira commented, if there are no instances the same executable running; if there is at least one, and try to run in VS will not work.

1 answer

3


There is probably a process already running from Exe that gets inside the bin. Ai the compiler tries to rewrite and cannot.

It has happened to me many times so just do the steps below that should work.

Solution: Press CTRL+SHIFT+ESC, go to processes find the process Learning videoaula1.exe in your case, finish it and try again.

  • Dude, is there something wrong with my code? Because sometimes it runs, but the screen stays black. And, actually, it happens what you told me, grip F5 the program rotates and closes when I go on CTRL+F5, I looked in the task manager and the process was already executed, but if I try to finish closes all Visualstudio

  • So man I don’t know much about C#, to answer that. But the problem is that the process is started. What you can try to do is give a Finish() or a Close() if I’m not mistaken at the end of the code under the.writeline console so the process won’t get stuck.

  • Tranquil I found a problem in the code, I even edited the question. However your answer was useful yes. I wasn’t even thinking of checking the processes. Thanks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.