Unhandled exception: BadImageFormatException: Bad IL format. The format of the file 'XXXModuleRules.dll' is invalid.

Hello brs-sebascova

Thank you for your quick reply. Following your advice I could remove the warning

Visual Studio 2022 compiler version 14.43.34810 is not a preferred version. Please use the latest preferred version 14.38.33130

by selecting this version in the Visual Studio Installer

I also follow the installation instructions from

Setting Up Visual Studio Development Environment for C++ Projects in Unreal Engine | Unreal Engine 5.5 Documentation | Epic Developer Community

and install the designated versions MSVC, Windows SDK, LLVM, .Net, added the required workloads and added the required components

I also updated the BuildConfiguration.xml under C:\Users\XXX\AppData\Roaming\Unreal Engine\UnrealBuildTool as suggested in

Packaging error ‘detected compiler newer than visual studio 2022’ - beginner - Development / Programming & Scripting - Epic Developer Community Forums

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<WindowsPlatform>
<CompilerVersion>14.38.33130</CompilerVersion>
<ToolchainVersion>14.38.33130</ToolchainVersion>
</WindowsPlatform>
</Configuration>

I restarted my system to be sure that all packages are loaded fresh but nevertheless when I want to create a new blank C++ Project in Unreal I still got the BadImageFormatException.

The recent log looks like that:

Running C:/Program Files/Epic Games/UE_5.5/Engine/Build/BatchFiles/Build.bat -projectfiles -project=“C:/work/Unreal Projects/QuickStart/QuickStart.uproject” -game -rocket -progress
Using bundled DotNet SDK version: 8.0.300
Running UnrealBuildTool: dotnet “....\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“C:/work/Unreal Projects/QuickStart/QuickStart.uproject” -game -rocket -progress
Log file: C:\Users\XXX\AppData\Local\UnrealBuildTool\Log_GPF.txt

Generating VisualStudio project files:
Discovering modules, targets and source code for project…
Total execution time: 1.38 seconds
Unhandled exception: BadImageFormatException: Bad IL format. The format of the file ‘C:\work\Unreal Projects\QuickStart\Intermediate\Build\BuildRules\QuickStartModuleRules.dll’ is invalid.
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFile(String path)
at UnrealBuildTool.DynamicCompilation.CompileAssembly(FileReference OutputAssemblyPath, IEnumerable1 SourceFileNames, ILogger Logger, IEnumerable1 ReferencedAssembies, IEnumerable1 PreprocessorDefines, Boolean TreatWarningsAsErrors) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 289 at UnrealBuildTool.DynamicCompilation.CompileAndLoadAssembly(FileReference OutputAssemblyPath, IEnumerable1 SourceFileNames, ILogger Logger, IEnumerable1 ReferencedAssembies, IEnumerable1 PreprocessorDefines, Boolean DoNotCompile, Boolean ForceCompile, Boolean TreatWarningsAsErrors) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 351
at UnrealBuildTool.RulesAssembly..ctor(RulesScope Scope, IReadOnlyList1 BaseDirs, IReadOnlyList1 Plugins, IReadOnlyDictionary2 ModuleFileToContext, IReadOnlyList1 TargetFiles, FileReference AssemblyFileName, Boolean bContainsEngineModules, Nullable1 DefaultBuildSettings, Boolean bReadOnly, Boolean bSkipCompile, Boolean bForceCompile, RulesAssembly Parent, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 191 at UnrealBuildTool.RulesCompiler.<>c__DisplayClass9_0.<CreateProjectRulesAssembly>b__0(FileReference _) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs:line 332 at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at UnrealBuildTool.RulesCompiler.CreateProjectRulesAssembly(FileReference ProjectFileName, Boolean bUsePrecompiled, Boolean bSkipCompile, Boolean bForceCompile, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesCompiler.cs:line 247 at UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(PlatformProjectGeneratorCollection PlatformProjectGenerators, List1 AllGames, List1 AllTargetFiles, String[] Arguments, List1 EngineProjects, List1 GameProjects, Dictionary2 ProjectFileToUProjectFile, Dictionary2 ProgramProjects, Dictionary2 RulesAssemblies, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2791
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String Arguments, Boolean bCacheDataForEditor, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 1048
at UnrealBuildTool.GenerateProjectFilesMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 260
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 687

For me the setup looks like suggested, do you have another hint for me?

I would appreciate that a lot.

Thanks