diff --git a/RGiesecke.DllExport/DisabledAssemblyResolver.cs b/RGiesecke.DllExport/DisabledAssemblyResolver.cs index 4e38323..ca8b7fa 100644 --- a/RGiesecke.DllExport/DisabledAssemblyResolver.cs +++ b/RGiesecke.DllExport/DisabledAssemblyResolver.cs @@ -13,12 +13,20 @@ namespace RGiesecke.DllExport /// Related issue: https://github.com/3F/DllExport/issues/127 /// /// For issue127 we can also use DefaultAssemblyResolver.AddSearchDirectory(), - /// But we don't actually need any assembly resolving in our case at all. + /// But we don't actually need resolving of any ref assemblies. Only ref types in our meta attr. /// internal sealed class DisabledAssemblyResolver: DefaultAssemblyResolver { - public override AssemblyDefinition Resolve(AssemblyNameReference name) + public override AssemblyDefinition Resolve(AssemblyNameReference aref) { + // https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.callingconvention + // Assemblies: System.Runtime.InteropServices.dll, mscorlib.dll, netstandard.dll + + if(aref.Name == "System.Runtime.InteropServices" || aref.Name == "mscorlib" || aref.Name == "netstandard") + { + return base.Resolve(aref); + } + return null; // It will be considered as `resolved = false` due to internal ResolutionException processing in cecil. } }