Unable to rebuild basic C++ project - access to dll denied

Dear all,

I was amazed how easy it is to build and run UE4 under Linux! Now I’m forced to use it under Windows 10 and here comes the pain.

I have UE4.13 and Visual Studio Community 2015 running. If I create a new, minimalistic, C++ project and open it in the Editor I’m asked to build the dll which works fine. I can run the game and even build the code in VS without issues, the hot reload works fine.

But: after building the second time UE4 still says that it’s hot reloading but it seems to still run the old code! Even compiling from inside the editor didn’t help.

I’ve read somewhere that rebuilding the project in VS is suggested. So I did right click on MyProject → rebuild and then I got this:

output:

1>------ Rebuild All started: Project: MyProject, Configuration: Development_Editor x64 ------
1>  Cleaning MyProjectEditor Binaries...
1>  Compiling game modules for hot reload
1>EXEC : error : System.UnauthorizedAccessException: Access to the path 'C:\Users\Jonas\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-5052.dll' is denied.
1>     at UnrealBuildTool.UEBuildTarget.CleanFile(String Filename)
1>     at UnrealBuildTool.UEBuildTarget.CleanTarget(BuildManifest Manifest)
1>     at UnrealBuildTool.UEBuildTarget.GenerateManifest()
1>     at UnrealBuildTool.UEBuildTarget.Build(UEToolChain TargetToolChain, List`1& OutputItems, List`1& UObjectModules, String& EULAViolationWarning)
1>     at UnrealBuildTool.UnrealBuildTool.RunUBT(String[] Arguments, FileReference ProjectFile)
1>  Compiling game modules for hot reload
1>  Target is up to date
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(46,5): error MSB3073: The command ""C:\Program Files (x86)\Epic Games\4.13\Engine\Build\BatchFiles\Rebuild.bat" MyProjectEditor Win64 Development "C:\Users\Jonas\Documents\Unreal Projects\MyProject\MyProject.uproject" -waitmutex" exited with code -1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Error list:

Severity	Code	Description	Project	File	Line	Suppression State
Error		System.UnauthorizedAccessException: Access to the path 'C:\Users\Jonas\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-5052.dll' is denied.	MyProject	C:\Users\Jonas\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\EXEC	1	
Error	MSB3073	The command ""C:\Program Files (x86)\Epic Games\4.13\Engine\Build\BatchFiles\Rebuild.bat" MyProjectEditor Win64 Development "C:\Users\Jonas\Documents\Unreal Projects\MyProject\MyProject.uproject" -waitmutex" exited with code -1.	MyProject	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets	46	

I’ve found a few related but outdated issues (e.g. 3525, 295689), but they didn’t help me either!

I have already tried to run VS as Administrator but again no luck! Please note that this issue is easy to reproduce for me (did it several times using UE4.13 and 4.14) by doing the following:

  1. create a new C++ project
  2. open it in the editor
  3. open the code in VS
  4. rebuild in VS
    → here comes the error

Only shutting down the editor enables VS to rebuild. As soon as the editor is back up, it won’t rebuild…

So my understanding is that the editor locks the dll which VS tries to rewrite. Is there any way to make the editor release this lock?

Thanks for your time!

1 Like

My Solution for this was:

  1. Close Visual Studio.
  2. Go to Unreal Engine → C++ Classes
  3. Open up any class that you have made.

It seems that the Engine is using a file that prevents you from rebuilding the solution.
Having the engine open up visual studios instead of me doing it manually seems to have solved that issue for me.