The requested operation cannot be performed error

2019-03-24 18:18发布

问题:

When compiling a project for the second time I get the following error message. I have to close down VS 2010 and it compiles when reloaded. If I make a change then the problem comes back.

"Unable to copy file "obj\x86\Debug\MyFile.dll". The requested operation cannot be performed on a file with user-mapped section open."

回答1:

I had this problem for another cause. So I am sharing for those having this problem without the achievement extension

In my case, it was due to the project settings page being opened. I am using a type in my project as the type of one setting, so it appears that visual studio opens the dll to get the specs but don't release it automatically. Closing the settings page solve the problem or restarting visual studio.



回答2:

Found cause - it's to do with having Visual Studio Achievements extension installed. The problem goes away with this extension removed.



回答3:

I also faced the same issue due to a stupid mistake :) All I did is I kept the corresponding output dll open in Visual Studio Object Browser. Closing that dll from the object browser resolved the issue.



回答4:

I also hit this issue when trying to save a file in Visual Studio (so non XNA, but google seems to be guiding here).

Problem turned out to be that I had a partially completed git command running in my terminal - it was a diff against the file I was trying to save.

When I terminated the command then the problem went away.



回答5:

I've got the same problem, but I don't have Visual Studio Achievements extension installed !

I'am totally stucked with this problem, I con not build my code any more.



回答6:

In my case, this error was being caused by Microsoft Security Essentials scanning the file as soon as Visual Studio saved it before a compile. The compiler then tried to access the file and would find it locked by MSE. Adding the Visual Studio projects directory to the exclusions list made the error go away.



回答7:

For me it was Git extensions locking the file up. I killed the git process that had got stuck and rebuilt the project. If you cant find whats locking up the file you can always restart the computer :)