The requested operation cannot be performed on a file with a user-mapped section open

后端 未结 28 1569
深忆病人
深忆病人 2020-12-07 16:03

Whenever I tried to copy 4 files into my bin folder, after stopping the main service, I am getting an error with one file (TexteDll). The error is:

Cannot co         


        
相关标签:
28条回答
  • 2020-12-07 16:32
    • 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.
    0 讨论(0)
  • 2020-12-07 16:32

    If you're using profilers like AQ Time, these may also be locking the file. The solution in this case would be to restart the profiler or simply unload/load the assembly in question from the profiler. For AQ Time I noticed that it's releasing the file after some time, but I can't for the life of me tell what that timeout is. Seems to be random

    0 讨论(0)
  • 2020-12-07 16:33

    None of the solutions posted here worked for me. It was devenv.exe (Visual Studio) locking the file, but if I restarted it, it would re-lock it.

    Bizarrely, Windows wouldn't let me Delete the files (to Recycle Bin), but Shift+Delete (permanent delete) worked.

    0 讨论(0)
  • 2020-12-07 16:33

    I also got same error today. I have resolved this issue by re-building the project.

    0 讨论(0)
  • 2020-12-07 16:35

    I am a developer and do not like apps injected to Registery like Unlocker. I used SysInternals Process Explorer which process locked my dll Find > Find Handle or Dll [Ctrl-F] and killed the process.

    0 讨论(0)
  • 2020-12-07 16:36

    I was seeing these errors when building Dot Net applications with Ant.

    In my case it was our corporate backup software, the Symantec DLO Agent. Stopping it and excluding the directory in my antivirus software and closing Visual Studio seems to work.

    0 讨论(0)
提交回复
热议问题