Search code examples
c#filefilestream

Build error while running


I am trying to run a code snippet multiple numbers of times in C#.Project name is test.Initial number of times it's running properly but after that i am getting the following build error."Error 1 Unable to copy file "obj\x86\Debug\test.exe" to "bin\Debug\test.exe". The process cannot access the file 'bin\Debug\test.exe' because it is being used by another process.test". How can I get rid of this error.


Solution

  • It happens because sometime Test.exe keeps running even after you finish executing test.

    One solution is to kill Test.exe once your run is finished. There could be some side effects because of this. You might see some Test run Errors in next runs

    Better way is to disable Test Execution Running between runs

    Go to    Tools > Options > Test Tools > Test Execution
    
      Unselect "Keep test execution engine running between test runs"
    

    Can take this Referance.