Can't compile since migrating to a cloud drive?

Update: I managed to find a very easy solution to this problem. The second reply on this post, by “Rumbleball” fixes this problem.

I used to store my projects on a hard drive which I would use to work on my projects on both my PC and my laptop, and it worked very well. But I recently purchased Google One (their desktop cloud drive service, equivalent to OneNote or Dropbox Desktop, which acts as an external hard drive to store anything in the cloud) and moved my projects from my external hard drive to my cloud drive. But since moving my projects, I haven’t been able to compile them. Inside the engine, when hitting “compile”, I instantly receive the following error message:

  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: ERROR: Unhandled exception: System.IO.FileLoadException: Could not load file or assembly ‘file:///G:\My Drive\Projects\Kingdoms\Intermediate\Build\BuildRules\KingdomsModuleRules.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: File name: ‘file:///G:\My Drive\Projects\Kingdoms\Intermediate\Build\BuildRules\KingdomsModuleRules.dll’ —> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See <loadFromRemoteSources> Element | Microsoft Learn for more information.
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at UnrealBuildTool.DynamicCompilation.CompileAssembly(FileReference OutputAssemblyPath, HashSet1 SourceFileNames, List1 ReferencedAssembies, List`1 PreprocessorDefines, Boolean TreatWarningsAsErrors) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 380
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at UnrealBuildTool.DynamicCompilation.CompileAndLoadAssembly(FileReference OutputAssemblyPath, HashSet1 SourceFileNames, List1 ReferencedAssembies, List`1 PreprocessorDefines, Boolean DoNotCompile, Boolean TreatWarningsAsErrors) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 450
  • [2021.12.10-19.34.59:993][372]CompilerResultsLog: at UnrealBuildTool.RulesAssembly…ctor(RulesScope Scope, List1 BaseDirs, IReadOnlyList1 Plugins, Dictionary2 ModuleFileToContext, List1 TargetFiles, FileReference AssemblyFileName, Boolean bContainsEngineModules, Nullable`1 DefaultBuildSettings, Boolean bReadOnly, Boolean bSkipCompile, RulesAssembly Parent) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 110
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.RulesCompiler.CreateProjectRulesAssembly(FileReference ProjectFileName, Boolean bUsePrecompiled, Boolean bSkipCompile) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs:line 603
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.RulesCompiler.CreateTargetRulesAssembly(FileReference ProjectFile, String TargetName, Boolean bSkipRulesCompile, Boolean bUsePrecompiled, FileReference ForeignPlugin) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs:line 665
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.UEBuildTarget.Create(TargetDescriptor Descriptor, Boolean bSkipRulesCompile, Boolean bUsePrecompiled) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 675
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.BuildMode.CreateMakefile(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 487
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 247
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 219
  • [2021.12.10-19.34.59:994][372]CompilerResultsLog: at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 550

When trying to re-generate the VS Code files, I receive a similar error:

  • ERROR: Unhandled exception: System.IO.FileLoadException: Could not load file or assembly ‘file:///G:\My Drive\Projects\Kingdoms\Intermediate\Build\BuildRules\KingdomsModuleRules.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
    - File name: ‘file:///G:\My Drive\Projects\Kingdoms\Intermediate\Build\BuildRules\KingdomsModuleRules.dll’ —> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See <loadFromRemoteSources> Element | Microsoft Learn for more information.
    - at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    - at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    - at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
    - at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
    - at UnrealBuildTool.DynamicCompilation.CompileAssembly(FileReference OutputAssemblyPath, HashSet1 SourceFileNames, List1 ReferencedAssembies, List1 PreprocessorDefines, Boolean TreatWarningsAsErrors) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 380 - at UnrealBuildTool.DynamicCompilation.CompileAndLoadAssembly(FileReference OutputAssemblyPath, HashSet1 SourceFileNames, List1 ReferencedAssembies, List1 PreprocessorDefines, Boolean DoNotCompile, Boolean TreatWarningsAsErrors) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 450
    - at UnrealBuildTool.RulesAssembly…ctor(RulesScope Scope, List1 BaseDirs, IReadOnlyList1 Plugins, Dictionary2 ModuleFileToContext, List1 TargetFiles, FileReference AssemblyFileName, Boolean bContainsEngineModules, Nullable1 DefaultBuildSettings, Boolean bReadOnly, Boolean bSkipCompile, RulesAssembly Parent) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 110 - at UnrealBuildTool.RulesCompiler.CreateProjectRulesAssembly(FileReference ProjectFileName, Boolean bUsePrecompiled, Boolean bSkipCompile) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs:line 603 - at UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(PlatformProjectGeneratorCollection PlatformProjectGenerators, List1 AllGames, List1 AllTargetFiles, String[] Arguments, ProjectFile& EngineProject, ProjectFile& EnterpriseProject, List1& GameProjects, Dictionary`2& ProgramProjects) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2288
    - at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String Arguments) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 753
    - at UnrealBuildTool.GenerateProjectFilesMode.Execute(CommandLineArguments Arguments) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 198
    - at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\Build++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 550

I’m a little lost, because it worked fine when compiling inside an external hard drive. Does anyone know what the problem is?

Thanks in advance!

First: Cloud drives are EVEN WORSE than anti-virus software in screwing up compiler performance. I would never in 100 years rely on a cloud drive as the primary storage for anything. It’s great for copying some PDFs and pictures into, and maybe even a copy of my SSH keys (with passphrase) so they’re conveniently available elsewhere, but source code needs to live in proper, un-shared, directories. To collaborate with others, use source control (such as git or perforce or mercurial.)

Second: The reason this doesn’t work, is that “cloud drives” don’t allow executables/dlls to be loaded; this is likely to prevent malware from spreading, if someone were to upload a bad binary to a shared drive.

But I’ve been able to work within the cloud drive for a while now. I can open Unreal from it, and work on the project just fine. The only thing that doesn’t work is compiling C++ code. I can even compile blueprints, import data, and build and launch the game. The only thing I can’t do is compile the code.

I have told you what I know about the subject, with significant experience.
Whether you choose to keep bashing your head at something that won’t work or not, is up to you.
Good luck with your project!

I have told you what I know about the subject, with significant experience.
Whether you choose to keep bashing your head at something that won’t work or not, is up to you.
Good luck with your project!

I was actually able to find a very simple solution online, and the project now compiles inside of the cloud drive, and everything works perfectly. I updated the the original post with the solution.