Unreal Engine 4.9 - Cant build source when editor is open

I recently upgraded my project to 4.9 and ever since I have been unable to build the code in vs 2013 when the editor is open.
It builds fine when the editor isn’t open, but when it is I get these errors.

It was working absolutely fine in 4.8.3 - I could easily rebuild source on the fly with the editor open, so I am not sure what happened.

I am just wondering if this is a bug? or if this is something I might have done wrong?

Error 1 error : System.UnauthorizedAccessException: Access to the path ‘C:\Users\UserName\Documents\Unreal Projects\Demo\Binaries\Win64\UE4Editor-Outbreak.dll’ is denied. C:\Users\UserName\Documents\Unreal Projects\Demo\Intermediate\ProjectFiles\EXEC Demo

Error 13 error MSB3073: The command ““C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Rebuild.bat” DemoEditor Win64 Development “C:\Users\UserName\Documents\Unreal Projects\Demo\Demo.uproject” -rocket” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 43 5 Demo

Hey daveA1234-

Are you able to build a new code project with the editor open? Are the two errors posted the only things being reported when the build fails? Does building work if you use the Compile button inside the editor.

Cheers

Hi daveA1234,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

I’ve just encountered a similar problem with 4.9. The compile Button from the Editor does build the code now, so building from Visual Studio is not the way to go.
I guess the real question is: Is this a bug with 4.9, or the recommended workflow?

Hey BlissettDMB-

Did this start happening after upgrading your project as well? If you create a new code project in 4.9 are you able to compile that? What error messages do you get when attempting to compile? Are you able to compile with the editor closed?

HI , I think the problem stems from the fact that I may have introduced some bugs in the C++ code. So when attempting to compile from the Editor, the system would not compile.
Based on some of the threads on similar topics, I decided to close the editor and re-open (which you cant do if the code is failing). The main reason to want the Editor open is to use the Class Wizard, so I get a nice icon to represent the UE type (and gain familiarization with the Object Library). However, if you cant get back into the Editor, it means ‘deep-end’ (back to no sleep till 2am, etc).
So now I’m in Codeland without a ‘flashlight’, and lost another 2cm off the hair line.
I’ve got no way to get back to the editor until I can get the entire system building from C++.
Also note. Renaming C++ Files, is a bit more complicated what than the usual workflow. It requires closing the Editor, Cleaning the Solution, Rebuilding, and re-opening the editor. The community post have been helpful (How do I remove a C++ class from my project code? - C++ - Epic Developer Community Forums) in understanding this issue, but while doing this exercise, I’ve managed to have about 20+ C++ files (Headers and Source Files) wiped… That is to say files went missing for no apparent reason. Not fun!!! (To everyone seeing this. Do not do a permanent delete on any files while following this workflow).
I’ve not been able to get backinto the editor for the past 24hours (for this project, all other UE4 projects work perfectly!!!), as I’m still attempting to get UMG/Slate code building.
Finally, this is My first push at doing a UE4 C++ library, so I am actually learning the nuances of the workflows. That being said, I cant see a reason for code disappearing while cleaning and rebuilding the solution. If this were a production build!!! Yikes!!! Kindly let me know if I missed something.

Oh… Everything else is Fab. Love UE4… Just need to stabilize some of the workflows around:

  1. Renaming files… Should be straight forward.
  2. Adding Solution Folders for C++. UE4.9 You cant do this.
  3. Solution folders created in Visual Studio, dont tie back to the file system. This makes keeping track of where things are a bit difficult. I do allot of C# and I dont recall this being an issue.
  4. When adding code assets to the solution, you’ve got to manually select the folder where the file is to be placed. E.g. If you’ve previously added a file to GameFolder\Public\UI, and then you right click on the Private folder with intentions to place the files in GameFolder\Private, your prompted to place the file in last place on the file system you actually placed a file (i.e. GameFolder\Public\UI). Again, this might be a Visual Studio Glitch, but I’ve been using VS for years, and this would have sent me off the deep end years ago, that or I would have had a hardwired understanding of the glitch.
  5. Wish list. Is there a way to record the state of the UMG so we can automatically take a snapshot of that designer generated code into C++. Similar to Forms development in C#. E.g. All properties that are set are for the most part static. It would be so awesome to just have a recessive loop in the back ground that could generated the boilerplate code.
    Allot I know, but its been a 24 slog, and that’s just migrating a sample from one project to another to gain familiarity with the workflow.
    Any help on the above wold be great.
    Regards.
    Dave.

One More… If you create a brand new C++ Project. Both the Editor and Visual Studio will launch. If you immediately attempt to build the VS C++ Project, it will fail with Access Denied. This seams logical as the Editor May need to lock certain files, but to a newbie (like myself), this may cause alarms.

Where are the error messages when you try to compile your project? Also, what error messages do you get when trying to compile a new project? Are you experiencing this after upgrading from one engine version to another?

Hi I have the Same Issue here. This used to work in UE 4.8.3 where you could rebuild the solution in VS2013 while the editor was still open. However in UE 4.9.2 this error message occurs when attempting to rebuild the solution while the editor is open:

2>EXEC : error : System.UnauthorizedAccessException: Access to the path ‘C:\projects\ancestor\Ancestor\Binaries\Win64\UE4Editor-Ancestor.dll’ is denied.
2> at UnrealBuildTool.UEBuildTarget.CleanFile(String Filename)
2> at UnrealBuildTool.UEBuildTarget.CleanTarget(BuildManifest Manifest)
2> at UnrealBuildTool.UEBuildTarget.GenerateManifest()
2> at UnrealBuildTool.UEBuildTarget.Build(IUEToolChain TargetToolChain, List1& OutputItems, List1& UObjectModules, String& EULAViolationWarning)
2> at UnrealBuildTool.UnrealBuildTool.RunUBT(String[] Arguments)
2> Creating makefile for hot reloading AncestorEditor (modules to compile have changed)
2> Compiling game modules for hot reload
2> Target is up to date.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(43,5): error MSB3073: The command ““C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Rebuild.bat” AncestorEditor Win64 Development “C:\projects\ancestor\Ancestor\Ancestor.uproject” -rocket -waitmutex” exited with code 2.
========== Rebuild All: 0 succeeded, 1 failed, 1 skipped ==========
If you close the editor and select rebuild in VS2013, it succeeds
Total build time: 53.35 seconds
========== Rebuild All: 1 succeeded, 0 failed, 1 skipped ==========

I encountered this problem with 4.9 and 4.8 while trying to get up to speed with the Visual Studio workflow. The following steps should get you past the errors and able to step through the code correctly:

  1. Ensure that you are running Visual Studio as Administrator (Right Click on the launch shortcut and select the option, then select the option… See Image)

65252-debiggameeditor00.jpg

  1. Ensure that you are running a Debug Profile as [DebugGame Editor] ( See image).

From here you should be able to code and step through the editor as per normal.

NB. It also means that you start your day from Visual Studio, not the editor. Good luck!

Hey RichardSo-

Was this error generated when selecting “Build” or “Rebuild” with the editor open? Unfortunately this doesn’t show what the actual error message is. Could you post the entire Output log from the failed VS build?

Cheers

Hi , It happens on both the Build and Rebuild. But Thanks to BissetMDB. His suggestion fixed it. The profile I was using was development. I switched to Debug Game Editor (I didn’t have to run VS as administrator.). I’m working in WIN8 which doesn’t give me the run as admin option when I open up the .sln file). but now it compiles and Hot Reloads as before when I do a rebuild with the editor open… I’m not sure how it got changed to Development Profile… maybe when I upgraded… Anyway, it works now. Thanks.

I solved the problem by delete the nameofthegame.dll and the nameofthegame.h.pch that appear in the error list and building again.