每当我试图复制4个文件到我的bin文件夹,停止主服务后,我得到一个文件(TexteDll)错误。错误是:

Cannot copy TexteDll: The requested operation cannot be performed on a file 
with a user-mapped section open

这可能是由于一些系统锁定。或者另一个进程正在使用这个DLL。当我在谷歌上搜索时,我发现重新启动系统可以解决这个问题。

有人能给出原因或者解决办法吗?我检查了TexteDll的属性(通用、版本、安全性等)。一切都很正常。


当前回答

Sometimes when you double click on a warning about the referenced assembly version mismatch between two or more projects you forget to close the assembly view window and it stays there among other tabs... so you end up with the assembly being locked by VS itself and it took me quite a lot of time to figure that out :) Be careful with the power VS provides ;) Another dummy scenario. Sometimes simply deleting the whole obj folder or just the file warned as the locked one helps out with this crappy error.

其他回答

我尝试了以上的方法,但对我不起作用。我遵循的几个步骤:

关闭所有VS实例,重新打开。 关闭build.exe和explorer.exe进程。 删除项目中的bin文件夹。

对我有用的是—— 重新启动我的机器。

你在运行杀毒软件吗?有可能是AV软件(或其他软件)正在使用文件映射api读取文件,这导致了问题。

我的解决方案是关闭所有VS实例,并杀死任何挂起的devenv.exe进程。

我也有同样的问题。我是这样决定的:

打开“任务管理器” 结束任务“Explorer.exe” 点击“文件”——>创建新任务——在“explorer.exe”中输入——> 清洁我的项目,它工作

发生在我把项目目标CPU从“任何CPU”改为“X64”,然后回到“任何CPU”之后。 通过删除Obj文件夹解决了这个问题(对于初学者:不要担心删除Obj文件夹,它将在下一次编译中重新创建)。