I am unable to enter play mode due to a compilation error that reads:
"error CS2012: Cannot open ‘C:Users[my name]Unity ProjectsBig Foot FellaLibraryBeeartifacts1900b0aE.dagAssembly-CSharp.dll’ for writing — ‘The requested operation cannot be performed on a file with a user-mapped section open. : ‘C:Users[my name]Unity ProjectsBig Foot FellaLibraryBeeartifacts1900b0aE.dagAssembly-CSharp.dll”
Unlike other people I’ve seen with similar problems, I haven’t even tried building my game yet.
It seems to have started happening after I installed .Net SDK 8.0.101 earlier this week in order to fix Intellisense in Visual Studio Code (which worked).
So far, I’ve tried:
- Moving the project file (by copy + pasting it) to out of my Users folder, restarting my computer, and moving it back into my projects folder. Opening a duplicate of the project file for the first time seems to cause the error to go away, but only until I open Visual Studio Code again. I’ve tried both deleting the old copy of the project before pasting the new copy back into Unity Projects (but after restarting) and not deleting it, which doesn’t seem to change results.
- Using Resource Manager to see what other program is opening that ‘1900b0aE.dagAssembly-CSharp.dll’ file (following instructions on this page). Strangely, unless I’m doing something wrong, there doesn’t seem to be a process opening the file, even when I try looking while I have the project open in Unity.
2
Answers
After asking around, I was recommended MalwareBytes as an alternate av, if anyone's looking for a Webroot replacement. After installing it, I disabled RealTime Shield on Webroot, and that fixed my issue, so anyone else having this problem can also try just turning that off whenever they're working on their project.
I too ran into this problem. VS refuses to build with the error message:
"The requested operation cannot be performed on a file with a user-mapped section open"
The file is a C# dll created by Visual Studio.
This problem appears to only affect users with Webroot AV. There is a work-around. Stop Webroot by right clicking the tray icon and selecting "Shut Down Protection."
I discovered just today that the problem is due to a lock that is created after a Webroot scan. Shutting down Webroot removes the lock so that you can build again.
You can also restart it right away and you won’t have to shut it down again until Webroot does another scan, which is typically 24 hours – at least on my system. You can also leave Webroot down, but then that has other risks.
I have opened a ticket with Webroot, ticket # 531944.