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

后端 未结 28 1571
深忆病人
深忆病人 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:51

    The solution for me was to restart the computer.

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

    None of the above solved this issue.

    Someone had one project in my solution set to use x64 CPU in the build configuration. Changing it to Any CPU caused the build to use a new folder. I still don't know what process had (has) a lock on that file.

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

    In my case, I just close all instance and copy my root application folder and paste it in different location then open solution in VS it works....

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

    It has been pointed out in 2016 by Andrew Cuthbert that git diff locks files as well until you quit out of it.

    That won't be the case with Git 2.23 (Q3 2019).

    See commit 3aef54e (11 Jul 2019) by Johannes Schindelin (dscho).
    (Merged by Junio C Hamano -- gitster -- in commit d9beb46, 25 Jul 2019)

    diff: munmap() file contents before running external diff

    When running an external diff from, say, a diff tool, it is safe to assume that we want to write the files in question.
    On Windows, that means that there cannot be any other process holding an open handle to said files, or even just a mapped region.

    So let's make sure that git diff itself is not holding any open handle to the files in question.

    In fact, we will just release the file pair right away, as the external diff uses the files we just wrote, so we do not need to hold the file contents in memory anymore.

    This fixes git-for-windows#1315


    Running "git diff"(man) while allowing external diff in a state with unmerged paths used to segfault, which has been corrected with Git 2.30 (Q1 2021).

    See commit d668518, commit 2469593 (06 Nov 2020) by Jinoh Kang (iamahuman).
    (Merged by Junio C Hamano -- gitster -- in commit d5e3532, 21 Nov 2020)

    diff: allow passing NULL to diff_free_filespec_data()

    Signed-off-by: Jinoh Kang
    Signed-off-by: Junio C Hamano

    Commit 3aef54e8b8 ("diff: munmap() file contents before running external diff", Git v2.22.1) introduced calls to diff_free_filespec_data in run_external_diff, which may pass NULL pointers.

    Fix this and prevent any such bugs in the future by making diff_free_filespec_data(NULL) a no-op.

    Fixes: 3aef54e8b8 ("diff: munmap() file contents before running external diff")

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

    In my case it was the Explorer that was locking the DLL that was been compiled in the Debug folder... Strange, isn't it?

    I found out using a tool called Unlocker.

    Had to delete with Unlocker, even when it was saying that there was no lock over the file, and I couldn't delete the folder until I didn't delete that single file...

    After that it compiled.

    EDIT:

    I found out why in my case this was happening. I had the DLL opened in a text editor inside Visual Studio...

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

    I had same problem and in my case it appeared that existing output file was locked by other application.

    You can check which application is locking your output file with OpenedFilesView: http://www.nirsoft.net/utils/opened_files_view.html

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