requested operation cant be performed on file with user-mapped section open

    General discussion

  • hiya,
    I get the above error in my winforms app.
    The complete error is:

    The file 'uipMyApp.Launcher.exe' cannot be copied to the run directory.  The requested operation cannot be performed on a file with a user-mapped section open.

    I have googled +  errorBank but am none the wiser.Has anyone had this error before?

    Tuesday, May 10, 2005 10:24 AM

All replies

  • Hi Yogi,

    I'm not sure what this error message means, either, but you might want to try breaking down your app into the simplest possible pieces to determine what works and then add to it until it breaks. Without having more details, this is probably your best course of action for now.

    Tuesday, May 10, 2005 6:38 PM
  • cheers Paul.

    In believe that error might have been caused by user permissions on the folder that contains the EXE.I moved to another location on the hard drive and all is well.I am curious as to how vis studio 2003 builds and moves the dll's etc to the output folder...can anyone recommend  decent articles?

    In the process of searching for a solution to my error, I  came across a nice wee tool that might be useful for some people.

    It can.." Remove *.user files (which can cause file reference problems)" etc etc:
    I am not affiliated with it.

    Many thanks, 

    Wednesday, May 11, 2005 5:26 AM
  • I was getting this error too.  All it means, as far as I can tell, is that a user is using the form and so I couldn't copy a new version over to the server.  I'm using Oracle Forms, and I found when I stopped OC4J_BI_Forms I was able to copy the compiled version of my forms over.  I get the feeling you're not using Oracle Forms, but my guess is there is an equivalent solution for whatever it is you are using.
    Monday, May 16, 2005 3:14 PM
  • Hello, I solve this problem with copy all files in the project folder to a new folder. Then the project compile again.

    Thursday, August 25, 2005 9:18 AM
  • Just to say that I'm starting to get the same message error while printing from a RM/Cobol procedure....
    Sunday, March 19, 2006 7:57 PM
  • I got the same error when trying to use

    File.WriteAllText("logreport.txt", s);

    in VC#.

    What is funny is that exactly the same code (copy-paste) runs OK on other computer or even on the same computer but as the part of new VC# project.

    What I did is to copy the project from USB memory stick when moving project files from one computer to another.Could this be the reason for the problem?

    Monday, November 06, 2006 1:32 PM
  • I'm pretty sure this means that another program is using the file so it can't be modified.

    We have just had it during a decrypt operation, and I'm pretty sure it was after a crash which may have occured whilst this file was being loaded, saved, encrypted, or decrypted.

    From the research I've done elsewhere the idea of a process hanging arouond with the file open seems to be the most likily candidate.

    A reboot should fix the problem but if it happens repeatedly this would suggest you have a process crashing leaving files open or some other unknown process using the file.

    I hope this helps.


    Friday, January 05, 2007 12:08 PM
  • Hi,
    The problem, in most of the cases, is caused by a System locking.
    You could try to delete all "bin" and "obj" folders under your solution.

    If you have an "Access denied" or "file it's being using by another process" you may use the Unlocker to unlock the file.

    You can find the Unloker at the next link

    See ya.
    Friday, February 09, 2007 12:43 AM
  • The ol' restart Visual Studio fix worked for me. Too bad it takes 5 minutes to reload my solution.
    Wednesday, April 11, 2007 6:08 PM
  •  Series80user wrote:
    Hello, I solve this problem with copy all files in the project folder to a new folder. Then the project compile again.


    I tested that. I excluded the obj and bin folders and just copied the source code. It worked fine! Thanks!

    Monday, November 12, 2007 12:56 PM
  • Anders you have AVOIDED the problem. This is NEVER a solution in my mind.


    All unsolved problems just LURK about and cause other problems


    Paul Suret


    Sunday, December 23, 2007 7:58 AM
  • I had a similar problem.  Turns out, I had a Crystal Report open in the external Crystal Reports product.  After closing that I was able to compile my project.
    Friday, January 11, 2008 4:25 PM
  • I ran into this error, however I was not using the Web Development Project in Visual Studio - I was instead using aspnet_compile.exe and aspnet_merge.exe. This was the workflow that generated the problem... (Changed the name of the directory so I may have mistyped something, hopefully you get the idea).


    I used MSBuild actually, aspnet_compile has an MSBuild target.


    Here is my p.proj file:

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="PrecompileWeb" xmlns="">
        <Target Name="PrecompileWeb">


    Opened a visual studio 2008 command prompt, cd'd to: f:\projects\p\src


    Then I ran this by executing...


    C:\Windows\Microsoft.NET\Framework\v2.0.50727\msbuild src\p.proj


    This worked fine.  (However, if you are later on, with the merge tool, running into error "warning 1013: cannot find any assemblies that can be merged in the application bin folder." - you have not set updateable = false!)


    Then I copied aspnet_merge.exe to my lib folder - you need to download this tool from the windows sdk


    Then I ran the merge.


    ..\lib\aspnet_merge.exe p.precompiled -o p.dll


    This gave me the error: aspnet_merge: error occurred: An error occurred when merging assemblies: The requested operation cannot be performed on a file with a user-mapped section open.


    Then I re-ran the command with -errorstack on the end...


    [IOException]: The requested operation cannot be performed on a file with a user
    -mapped section open.

       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
    nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
    ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share)
       at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols,
     Module module, Boolean delaySign, String keyFileName, String keyName)
       at System.Compiler.Module.WriteModule(String location, Boolean writeDebugSymb
       at ILMerging.ILMerge.Merge()
       at System.Web.Compilation.Merge.DoMerge(ILMerge merge)
       at System.Web.Compilation.Merge.MergeToSingleAssembly(String outputFile, Stri
    ng[] inputAssemblies, Hashtable assemblyMapping, DirectoryInfo inputDirectory, D
    irectoryInfo outputDirectory)
       at System.Web.Compilation.Merge.Main(String[] args)


    Banged my head against the wall for awhile and realized that i actually had the same dll name specified as the -o (output) filename as was already existing. This is the command that finally worked...


    ..\lib\aspnet_merge.exe p.precompiled -o p2.dll


    Hope this helps someone!

    Wednesday, April 16, 2008 11:27 AM
  • Thanks!  That solved the exact problem I had.


    Wednesday, May 28, 2008 3:29 PM
  • umbyersw, You solved my exact problem too!

    Long story short (in case you are too hurried to read umbyersw problem/solution), you'll get this error message in a Web Deployment Project build during the aspnet_merge.exe run if you have the deployment projects "Output Assemblies" tab set to "Merge all outputs to a single assembly" and the Assembly name is the same as another assembly (probably your web application project's assembly name) in the project.
    Tuesday, June 10, 2008 9:56 PM
  • After surviving the .DLL He11 erra, the simple chore of shutting down Visual Studio from time to time when updating core .dll files is a welcome task.  Thats for the posts all, I had done a number of things *except shut down studio.  Should have searched first, I booted my users with a good ole IISReset just before searching the web.  -James
    Wednesday, August 06, 2008 7:55 PM
  • Exactly what happened to me. Thanks to your post I was able to get through the trouble. Thank you very much.
    Monday, September 08, 2008 5:42 AM
  • Re-building the solution worked for me :)
    Thursday, May 14, 2009 11:57 AM
  • hey Paul,

    I just wanted to thank you for your time and effort, because, you have just found the solution to my problem.

                  ,Thanks Steff_Bitz
    Saturday, September 05, 2009 10:19 PM
  • Thanks that solved my problem.
    Wednesday, April 14, 2010 2:15 PM
  • Hi Guys,


    If you are using AVG on the machine you are developing on you need to add an exception to the Resident Shield application. This causes the above error in Windows 7, I was using Eclipse but give it a try for Visual Studio.

    Friday, July 22, 2011 10:38 AM
  • I started getting this problem out of the blue when trying to save ordinary html files after editing with EW4. I had recently installed Copernic desktop search (because Windows Explorer file search doesn't work properly - can't find "center" as in "align="center"" in a dumb html file for example). As soon as I had removed Copernic, I could save my EW2 html files again. This happened on Windows 7 Home Premium 64-bit. 

    Back to square one finding another desktop file search program that works.

    Thursday, November 22, 2012 11:42 PM