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

后端 未结 30 1866
青春惊慌失措
青春惊慌失措 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:43

    Well, I solved the problem myself - though I still have no clue why. I decided to isolate the problem by removing all files from the project, then re-adding them and determining that way which file was the source of my trouble. So, one by one I reintroduced files to the project, compiled & cleaned each step of the way... until... I added the last one...

    ... and everything still worked fine.

    I did a compare to the source control of my original .csproj; no real differences. And even when I tried reverting to the previous version of the .csproj, it still worked.

    Black magic. If it works, sometimes it's better not to ask why - just accept it and move on...

    EDIT: The problem is a recurring one, and I believe I've isolated it to when I have the form designer open of an abstract/generic form at compile time.

    Lesson learned: Make sure the Form Designer of any abstract or generic forms or controls is closed before you compile! If not, you have to close VS and reopen!

提交回复
热议问题