none
VS2017 Build Error The process cannot access the file RRS feed

  • Question

  • Hello,

    I am running VS2017 version 15.3.3.  I just updated it yesterday in an attempt to resolve this issue.  When I attempt to build a C# WPF project for a second time, I get a build error telling me the .EXE file is in use by another process.  Closing the solution and reopening allows me to build the project.  This is very annoying and unproductive.  

    This only occurs after I edit and save the MainWindow.xaml file.  I have also tried closing the xaml file before attempting the second build without any success.  

    Wednesday, September 6, 2017 1:45 PM

All replies

  • Hi Steve Schrecengost,

    Thank you for posting here.

    According to your question is more related to MS Build, I will move it to MSBuild forum fro suitable support.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Best Regards,

    Wendy


    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, September 7, 2017 5:58 AM
  • Hi Steve Schrecengost,

    >>>VS2017 Build Error The process cannot access the file

    There are many reasons for this build error. I would like give you some troubleshoots:

    1. Wait a while longer before build the project second time and eventually the file will be closed by MSBuild

    2. Try to clean solution before re-build it or delete the bin & obj folder, then rebuild your project. 

    3. Close all .xaml files before re-build the solution in the IDE

    4. Use the Process Monitor on your machine to tracking the events on that folder/file, then run your build definition again, and check which processer accessing that folder/file at that same time, then end it.

    Help this helps.


    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, September 7, 2017 10:03 AM
  • Hello,

    Thank you for taking the time to respond.  This seems like a bug in Visual Studio that has been there for quite some time.  I was hoping to be pointed toward a patch that would resolve this issue.  I am new to WPF and this will probably cause me to abandon WPF for Forms because I cannot work with the productivity losses this issue causes.

    Allow me to comment on your suggestions.

    1. This is even less productive than my current practice of closing the solution and re-building.
    2. Clean does not help this issue.  VS has the file locked.  It cannot be deleted.  I have tried.
    3. I have tried this.  It doesn't work.
    4. While I have not tried this, it is another work around.  Closing the solution and re-opening without shutting down VS works do this would indicate VS has a hook to this file that it is not giving up after the first build/debug test run.

    Is anyone aware of a solution to this bug?

    Thursday, September 7, 2017 11:28 AM
  • @Steve Schrecengost, sorry that not help. It shoud not a bug, because I could not reproduce this issue. Have you ever try to check if this issue still occur on a new WPF project? Besides, you said you could not delete the bin & obj folder, have you close the all VS instance and restart machine?

    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, September 7, 2017 2:04 PM
  • I have tried rebooting the computer even though that is not necessary.  Simply closing and reopening the solution in VS allows the project to build.

    I first noticed this problem on a large project.  I created a new project to test this issue without any controls on the MainWindow.  

    From my internet searches, I see this is an ongoing issue with VS and WPF since 2008.  I do not see how this is not a bug in VS.

    Thursday, September 7, 2017 2:18 PM
  • @Steve Schrecengost, thanks for your reply. Do you mean that you still have this issue on the new project? That`s strange. Could you please test this problem on another machine? And could you share us some detail steps so that we could reproduce this issue or you can record a video how did you reproduce this issue and share us the link. Thanks.

    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.

    Friday, September 8, 2017 8:19 AM
  • I am not able to test on another machine.  The steps taken to cause and work around this issue are very simple.

    To cause the issue, build the project with a XAML file open or after editing a XAML file even if the file is closed.  The project will build successfully the first time but not the second attempt.

    To work around the issue, close the XAML file and close the solution.  Reopen the solution and the project will build.

    I have confirmed, using Resource Monitor, that it is the XDesProc.exe process that is accessing the project's .exe file.  This is the VS XAML designer.  This process is waiting for another process, devenv.exe. Stopping the XDesProc process and closing the XAML files allows me to build the project.  

    Tuesday, September 12, 2017 7:34 PM
  • Thanks again for you reply. I also see many others reported this issue, but this issue can't seem to reliably reproduce it. So we could not give a effective solution, just tourble shooting it. As suggestion, you can try to change the building configuration at the top (if in “Release” to “Debug” and vice versa), build and then change back to previous configuration and build again.

    Yes, this too is somewhat inconvenient, but it sure no need have to restart VS.

    If possible, you can check below link:

    https://stackoverflow.com/questions/11646047/error-cannot-access-file-bin-debug-because-it-is-being-used-by-another-proc


    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.

    Friday, September 15, 2017 4:33 PM
  • I have the same problem with VS 2017 Community (v15.8.0) developing simple WPF application
    Helps only killing XDesProc.exe process

    Remark: the problem exists only if the project is located in "C:\Program Files\..." folder. If I move the project to "C:\Users\MY_NAME\..." folder then everything works fine.


    • Edited by tms320 Saturday, August 18, 2018 6:21 PM
    Thursday, August 16, 2018 3:29 PM
  • The problem is probably that you are building to the "Program Files" or "Program File (x86)" folder and it fails because "Visual Studio XAML Designer" is still running.  I find this so annoying that I have to keep killing the 'Xaml Designer' task in order to build if I want to build and debug my application in-place.

    Scott

    Tuesday, October 30, 2018 2:42 PM
  • Same problem:

    VS XAML designer locks file and cannot build when using Program Files (x86) folder

    I have messed around enough with the folder permissions that it finally let me build it where I need it

    Wednesday, March 20, 2019 10:55 AM
  • Still a problem in 2019 and it's still really annoying. No switching to Release and back to Debug does not fix it. Only solution I've found is exit Visual Studio, delete offending file, restart VS. Compile.

    "Unable to copy file _____ to _____. The process cannot access the file _____ because it is being used by another process. The file is locked by: "Microsoft Visual Studio XAML Designer"

    Signature..???

    Monday, June 17, 2019 1:22 PM
  • thanks alot

    the problem was that project is located in "C:\Program Files\..." folder

    once i relocated it, it works fine

    Friday, November 29, 2019 3:08 PM