15

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."

LU RD
  • 34,438
  • 5
  • 88
  • 296
Simon Jefferies
  • 415
  • 4
  • 16
  • 1
    Strangely enough I got this in a non-XNA project yesterday. Seems like a VS/MSBUILD bug. – Jonathan Dickinson Jan 25 '12 at 22:22
  • I'd suggest posting in the [App Hub Forums](http://forums.create.msdn.com/forums/), as it might be an issue with XNA and the build process it uses (then again, it might not as @JonathanDickinson's comment seems to indicate). – George Duckett Jan 25 '12 at 22:30
  • @GeorgeDuckett our build strategy is incredibly complex and it doesn't surprise me that VS bjorks once in a while on what we expect of it. – Jonathan Dickinson Jan 25 '12 at 22:39
  • Out of curiosity how many projects do you have in your solution? When you say complex what do you mean - ie lots of references project dependencies? – Simon Jefferies Jan 25 '12 at 22:43
  • Another thing to add to the equation, what OS are you using? – Neil Knight Jan 26 '12 at 08:37
  • I'm using Windows 7 64-bit. One thing i've noticed is that there were a bunch of VS 2010 SP1 updates this week which I suspect could have caused this. I'm rolling back each one in turn to see if this caused it. – Simon Jefferies Jan 26 '12 at 09:27

7 Answers7

19

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.

Yepeekai
  • 2,545
  • 29
  • 22
13

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

Simon Jefferies
  • 415
  • 4
  • 16
  • 3
    HUGE thanks. This issue had been bugging me for almost a week! However it started occurring only a few days after I had installed achievements, so I didn't notice the link. Thanks! – Cesar Jan 27 '12 at 17:12
  • I suspected that was the case. Thanks for confirming. – AlignedDev Feb 01 '12 at 15:25
4

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.

Ashraf Alam
  • 3,500
  • 32
  • 31
2

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.

KevinT
  • 3,094
  • 4
  • 26
  • 29
  • 1
    I get this all the time when I build from a Powershell command line, and I suspect Git has something to do with it. It happens to me when I don't have any active git tasks running. – Eric Z Beard Jun 20 '12 at 18:33
0

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.

Alex J
  • 9,905
  • 6
  • 36
  • 46
0

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 :)

astro boy
  • 1,410
  • 1
  • 11
  • 16
0

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.

flamandier
  • 502
  • 4
  • 6
  • What plugins do you have installed? i would disable each one in turn and see if that makes a difference. I found the issue was related to CodeAnalysis usage, hence VS Achievements. – Simon Jefferies Apr 02 '12 at 14:52