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

**URL:** <https://forums.unrealengine.com/t/unhandled-exception-badimageformatexception-bad-il-format-the-format-of-the-file-xxxmodulerules-dll-is-invalid/2493634>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [May 6, 2025, 2:57pm UTC](https://forums.unrealengine.com/t/unhandled-exception-badimageformatexception-bad-il-format-the-format-of-the-file-xxxmodulerules-dll-is-invalid/2493634 "2025-05-06T14:57:54Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![tsi6800](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tsi6800](https://forums.unrealengine.com/u/tsi6800)\
**Post date:** [May 7, 2025, 12:29pm UTC](https://forums.unrealengine.com/t/unhandled-exception-badimageformatexception-bad-il-format-the-format-of-the-file-xxxmodulerules-dll-is-invalid/2493634/3 "2025-05-07T12:29:40Z")

</div>

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

 ![MSVC_14.38-17.8_Screenshot 2025-05-07 141225](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/d/1bd371a2d05b51c9316379adad427420a7f5b7e2.png)

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](https://dev.epicgames.com/documentation/en-us/unreal-engine/setting-up-visual-studio-development-environment-for-cplusplus-projects-in-unreal-engine)

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

 ![VS_Setup_Unreal5.5_Screenshot 2025-05-07 141803](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/8/7/d87030e940016038ead43ca4d4dfff4b452eacaf.png)

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](https://forums.unrealengine.com/t/packaging-error-detected-compiler-newer-than-visual-studio-2022-beginner/2174644)

```auto
<?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, IEnumerable`1 SourceFileNames, ILogger Logger, IEnumerable`1 ReferencedAssembies, IEnumerable`1 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, IEnumerable`1 SourceFileNames, ILogger Logger, IEnumerable`1 ReferencedAssembies, IEnumerable`1 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, IReadOnlyList`1 BaseDirs, IReadOnlyList`1 Plugins, IReadOnlyDictionary`2 ModuleFileToContext, IReadOnlyList`1 TargetFiles, FileReference AssemblyFileName, Boolean bContainsEngineModules, Nullable`1 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.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 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, List`1 AllGames, List`1 AllTargetFiles, String[] Arguments, List`1 EngineProjects, List`1 GameProjects, Dictionary`2 ProjectFileToUProjectFile, Dictionary`2 ProgramProjects, Dictionary`2 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

---

_[View the full topic](https://forums.unrealengine.com/t/unhandled-exception-badimageformatexception-bad-il-format-the-format-of-the-file-xxxmodulerules-dll-is-invalid/2493634)._
