Build error: “The process cannot access the file because it is being used by another process”

后端 未结 30 1842
青春惊慌失措
青春惊慌失措 2020-12-13 03:08

I\'ve got a C# webforms app, that until today had been working just swimmingly.

Now today, all of a sudden, every time I try run the app, I get a file l

相关标签:
30条回答
  • 2020-12-13 03:52

    VS2017 - Solved by closing all instances of MSBuild.exe in the windows task manager

    0 讨论(0)
  • 2020-12-13 03:52

    Just to throw in my 2 cents. My issue was solved by opening Task Manager and killing the application. It was running in the background without any indication that it was running at all (no item in the task bar, no ui, nothing), but I am not sure why this happened. Obviously the debugger was not running and I only had a single instance of VS opened at the time. It amazes me that this is still happening in this VS 2017.

    Perhaps I can add a build step that looks for the application running the background and kills it before starting the new one.

    0 讨论(0)
  • 2020-12-13 03:52

    When I ended the process .Net Core Host, everything built fine. I didn't have to close Visual Studio or do change anything else.

    0 讨论(0)
  • 2020-12-13 03:53

    Just check the references and remove the self-reference to the project.

    Explanation: My problem started after creating a custom control and drag and drop it to the toolbox palette for use it in design forms. First appeared a warning saying that there was a redundance between the custom control source file (.cs) and the projects executable (.exe). On executing/debugging appeared the error: unable to access the (.exe) because it's being used (and it was true).

    I literally removed the whole source code regarding the custom control and the problem still remained, until I checked out the references and it was referencing itself in order to be "able to" get the former custom control. I removed the reference and done!!

    0 讨论(0)
  • 2020-12-13 03:53

    In my case there were some vstest processes running (with various names but all containing the string vstest). I had to terminate them in taskmgr.

    0 讨论(0)
  • 2020-12-13 03:55

    Deleting Obj, retail and debug folder of the .NET project and re-building again worked for me.

    0 讨论(0)
提交回复
热议问题