none
The process cannot access the File 'bin\release\FileName.exe' because it is being used by nother process

    Question

  • I finally figured out how create an msi file (with help from https://msdn.microsoft.com/en-us/library/cc766795.aspx?f=255&MSPPError=-2147217396)
    But now I am getting warning and error messages when I try to the solution in debug mode.
    I  uninstalled the setup file and deleted the setup folder but it made no difference.
    Then I restarted the computer and the error messages were not there anymore. 
    So I thought at least I have a way to get around this issue. 
    However, the next time the warnings and error came back and have been coming back since then.   I cannot make an msi file anymore.
    Warning 1 
    Could not copy "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".
    Beginning retry 1 in 1000ms.
    The process cannot access the file 'bin\Release\FileName.exe'
    because it is being used by another process. 

    Error 12 
    Unable to copy file "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".
    The process cannot access the file 'bin\Release\FileName.exe' because it is being used by another process. 

    Anybody knows what is going on?


    BraafPaard

    Sunday, November 6, 2016 12:12 AM

All replies

  • You can use Process Explorer to find out what has a file locked. On the other hand, you can use VS's Build/Clean delete all files out of the bin folders and rebuild everything to see of the lock is gone and do a Rebuild of the solution

    http://www.howtogeek.com/school/sysinternals-pro/lesson3/all/

    https://msdn.microsoft.com/en-us/library/5tdasz7h.aspx

    Sunday, November 6, 2016 12:56 AM
  • Are the file names really FileName.exe?

    "Could not copy "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe". "

    Regardless what is trying to copy a file from "obj\x86\Release" to "bin\Release"? Isn't "bin\Release" where your applications .Exe is?

    Is "obj\x86\Release\FileName.exe" the same file name as your projects executable file name? And what file is "obj\x86\Release\FileName.exe"?

    Also what version of Visual Studio are you using? Later versions of Visual Studio come with the ability to create an installer for a project. The link you provide seems to be for early versions of Visual Studio (2008 to 2010) even if it still possibly works. And there isn't a Forum that Orca installer that I am aware of.

    Still I figure that both earlier versions of Visual Studio probably came with ClickOnce which can be used to create an installer.

    And if you are a single person, or small entity business which you would have to check into you can download and install Visual Studio 2015 Community for free. If you do that I would suggest creating a restore point on your system before trying to install it. As well download the ISO to copy to a DVD large enough to contain the ISO and install VS 2015 Community from the DVD. As well after you install it login to your account with it so its activation key will update or else after 30 days it will no longer work even though it is free.


    La vida loca

    Sunday, November 6, 2016 2:08 AM
  • What is going on is the underlying compiler has not released a lock on the file and have seen this when building solutions that is fixed by restarting Visual Studio which causes the lock to be released. If that does not work for you then I would suggest trying to first fully backup the solution folder then in Windows Explorer delete the obj folder and bin folder, in Visual Studio under Solution Explorer select clean solution then try the operation again.

    In the mean time I'm moving your question to the Visual Studio forum as this is not a VB.NET issue.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Sunday, November 6, 2016 10:03 AM
  • The problem went away when I manually copied the "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".  I only had to do this once.  Of course I don't understand it.

    Thanks for you interest.


    BraafPaard

    Wednesday, November 9, 2016 12:58 PM
  • FileName is an alias for the project name.  The error message was created during the msi file creation which therefore never completed. 

    The problem went away when I manually copied the "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".  I only had to do this once.  Of course I don't understand it.

    Thanks for you interest


    BraafPaard

    Wednesday, November 9, 2016 1:02 PM
  • Did not know that a Process Explorer existed.  I downloaded it but could not figure anything out with it.  I did not have time to figure it out but will look at it later.

    The problem went away when I manually copied the "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".  I only had to do this once.  Of course I don't understand it.

    Thanks for you interest


    BraafPaard

    Wednesday, November 9, 2016 1:04 PM
  • Did not know that a Process Explorer existed.  I downloaded it but could not figure anything out with it.  I did not have time to figure it out but will look at it later.

    The problem went away when I manually copied the "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".  I only had to do this once.  Of course I don't understand it.

    Thanks for you interest


    BraafPaard


    Seems to be if you had did a Build/Clean it would have taken care of it.
    Wednesday, November 9, 2016 7:28 PM
  • The problem went away when I manually copied the "obj\x86\Release\FileName.exe" to "bin\Release\FileName.exe".  I only had to do this once.  Of course I don't understand it.

    Thanks for you interest.


    BraafPaard

    Other members also reported this issue before:

    http://stackoverflow.com/questions/2625239/unable-to-copy-a-file-from-obj-debug-to-bin-debug

    It shared some troubleshooting steps:

    • Delete the .suo file in your project dir. Eventually need to create your whole solution from scratch.
    • Close any Windows Form Designers may remain open.
    • Use a prebuild script, which deletes the target from the output dir.
    • Disable the VS hosting process.

    If possible, you could test it in your side, one possible reason is that the file was called by other process or others.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 10, 2016 9:39 AM
    Moderator
  • I tried Build/clean, among many others, and that did not work. 

    BraafPaard

    Thursday, November 10, 2016 1:25 PM
  • Hi BraafPaard,

    Disabling the hosting process in the project properties.  Uncheck the option "Enable the Visual Studio hosting process" from the debug tab and see if that solves your issue.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, November 12, 2016 5:21 AM
    Moderator