无法将文件“ obj \\ Debug \\ MyProject.exe”复制到“ bin \\ Debug \\ MyProject.exe”。 该进程无法访问文件“ bin \\ Debug \\ MyProject.exe”,因为它正在被另一个进程使用。
谷歌搜索错误不会带来明显的错误,即VS认为文件已锁定。 它是绝对的Visual Studio本身锁定文件,因为当我关闭VS并重新打开它,项目执行罚款-第一次。 当我尝试第二次运行它时,出现文件锁定错误。
编辑:另一个有趣的发现:我什至不必运行该应用程序。 编译一次会导致文件锁定。 我不能连续编译两次!
此问题特定于我的解决方案中的一个项目。 所有其他项目都可以正常工作,并且可以执行多次。 只是这个项目被锁定了。
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 locking error:Unable to copy file “obj\\Debug\\MyProject.exe” to “bin\\Debug\\MyProject.exe”.The process cannot access the file “bin\\Debug\\MyProject.exe” because it is being used by another process.Googling the error doesn’t come up with anything beyond the obvious, ie VS thinks the file is locked.And it is definitely Visual Studio itself that locks the file, because when I close VS and reopen it, the project executes fine – the first time.When I try to run it a second time, I get the file locking error.Closing VS and reopening every time I want to run the app is not a viable workaround!How do I find out what’s locking the file, and stop it from getting locked?EDIT: Another interesting discovery: I don’t even have to run the app.Just compiling it once causes the file locking;I cannot compile twice in a row!This problem is specific to one project in my solution.All other projects work fine and can be executed as many times as I like.It’s only this one project that gets itself locked up.