【问题标题】:Why am I receiving this when trying to create a new UE4 C++ project ? (only C++ projects)为什么我在尝试创建新的 UE4 C++ 项目时收到此消息? (仅限 C++ 项目)
【发布时间】:2019-07-17 18:17:57
【问题描述】:

我收到一个不存在的项目文件的 IO 异常(我只是尝试创建该项目)

我尝试使用 Visual Studio 2017 而不是 2019(与 UE 4.22.3 的兼容性问题),但我的 windows SDK 没有发现任何问题(虚幻引擎论坛上的一些人说这可能是问题所在)和 VS 配置.

Running C:/Program Files/Epic Games/UE_4.22/Engine/Binaries/DotNET/UnrealBuildTool.exe  -projectfiles -project="C:/Users/Director/Documents/source/repos/Phz/Phz.uproject" -game -rocket -progress
Discovering modules, targets and source code for project...
ERROR: Unhandled exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\Director\Documents\source\repos\Phz\Intermediate\Build\BuildRules\PhzModuleRules.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
       File name: 'file:///C:\Users\Director\Documents\source\repos\Phz\Intermediate\Build\BuildRules\PhzModuleRules.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 http://go.microsoft.com/fwlink/?LinkId=155569 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, HashSet`1 SourceFileNames, List`1 ReferencedAssembies, List`1 PreprocessorDefines, Boolean TreatWarningsAsErrors) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 358
          at UnrealBuildTool.DynamicCompilation.CompileAndLoadAssembly(FileReference OutputAssemblyPath, HashSet`1 SourceFileNames, List`1 ReferencedAssembies, List`1 PreprocessorDefines, Boolean DoNotCompile, Boolean TreatWarningsAsErrors) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 427
          at UnrealBuildTool.RulesAssembly..ctor(DirectoryReference BaseDir, IReadOnlyList`1 Plugins, List`1 ModuleFiles, List`1 TargetFiles, Dictionary`2 ModuleFileToPluginInfo, FileReference AssemblyFileName, Boolean bContainsEngineModules, Boolean bUseBackwardsCompatibleDefaults, Boolean bReadOnly, Boolean bSkipCompile, RulesAssembly Parent) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 109
          at UnrealBuildTool.RulesCompiler.CreateProjectRulesAssembly(FileReference ProjectFileName, Boolean bUsePrecompiled, Boolean bSkipCompile) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs:line 488
          at UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(PlatformProjectGeneratorCollection PlatformProjectGenerators, List`1 AllGames, ProjectFile& EngineProject, ProjectFile& EnterpriseProject, List`1& GameProjects, Dictionary`2& ProgramProjects) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2104
          at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String[] Arguments) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 674
          at UnrealBuildTool.GenerateProjectFilesMode.Execute(CommandLineArguments Arguments) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 172
          at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 443

“Phz”是这些 DLL 名称中使用的项目名称。 是否有任何特定的 .NET Framework SDK 或我缺少的东西? (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)

【问题讨论】:

    标签: unreal-engine4


    【解决方案1】:

    您可以通过创建 C++ 类来创建蓝图项目,然后在 C++ 项目中对其进行转换。转到文件->新建 C++ 类

    【讨论】:

      【解决方案2】:

      错误消息中给出了您收到该错误消息的原因:

      ERROR: Unhandled exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\Director\Documents\source\repos\Phz\Intermediate\Build\BuildRules\PhzModuleRules.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
      

      由于该文件似乎位于您的本地 C 驱动器上,我怀疑它是您对网络共享的依赖 - 或者您可能有一些复杂的连接设置,其中一个或多个目录指向网络位置。无论如何,如果您搜索该行的结尾,即。 HRESULT: 0x80131515 你可以找到另一个关于 2011 年相同错误的 SO 问题。

      有一个相对简单的解决方案,来自那个 SO 线程,你可以在这里找到 https://stackoverflow.com/a/8535963/1327399。然而,根据我的测试,此解决方案不起作用。 devenv 可执行文件似乎没有参与 ue4 的“生成项目文件”命令。我的研究无法找到二进制/配置文件对来应用此解决方案来专门影响 UE4 并尽可能少地影响其他事情。

      确实有效的东西:我能够从另一个 SO 线程(即 .net 4 框架范围)中找到似乎是 nuclear option 的东西。

      绝对值得注意,正如 2011 blog post 关于此问题所做的那样,该解决方案可能存在无法预料的漏洞,因为从网络位置运行代码具有明显的风险。

      在你单挑出来的那一行,在你帖子的最后,你可以找到上述解决方案的依据。

      please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
      

      那个链接:http://go.microsoft.com/fwlink/?LinkId=155569

      如果有人更热衷于,我相信他们可以深入研究虚幻构建工具的源代码,并为 xml 行找到更合适的家。根据示例,它似乎需要嵌套在它所在的任何配置文件中的特定层次结构中。

      另外,但这可能不值得注意 [这里] - 在我的虚拟化 Windows 环境中,ue4 将项目文件生成到我的 NFS 共享上,但也遇到了错误。看似错误的错误;可能是微软 NFS 驱动程序中的一个错误,但谁知道呢。该错误表明存在写入错误,但事实证明没有发生[至少在灾难性级别]因为文件实际上已写入并且我能够打开它们 - 我没有做任何工作,所以我没有测试我是否可以毫无问题地保存更改。

      【讨论】:

        猜你喜欢
        • 2021-10-28
        • 2017-08-21
        • 1970-01-01
        • 1970-01-01
        • 2021-02-17
        • 2012-10-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多