From 5cca01533888985e7f360e762dbc88ed2c53ac19 Mon Sep 17 00:00:00 2001 From: Sam Byass Date: Sun, 29 Jan 2023 16:18:42 +0000 Subject: [PATCH] Core: DummyDll: Ensure __generated dll has correct ext --- .../OutputFormats/AsmResolverDummyDllOutputFormat.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs b/Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs index b83b75ec..2ad5cf60 100644 --- a/Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs +++ b/Cpp2IL.Core/OutputFormats/AsmResolverDummyDllOutputFormat.cs @@ -159,7 +159,11 @@ private static AssemblyDefinition BuildStubAssembly(AssemblyAnalysisContext asse }; //Setting the corlib module allows element types in references to that assembly to be set correctly without us having to manually set them. - var managedModule = new ModuleDefinition(imageDefinition.Name, new(corLib ?? ourAssembly)) //Use either ourself as corlib, if we are corlib, otherwise the provided one + var moduleName = imageDefinition.Name; + if (moduleName == "__Generated") + moduleName += ".dll"; //__Generated doesn't have a .dll extension in the metadata but it is still of course a DLL + + var managedModule = new ModuleDefinition(moduleName, new(corLib ?? ourAssembly)) //Use either ourself as corlib, if we are corlib, otherwise the provided one { MetadataResolver = metadataResolver };