cecil icon indicating copy to clipboard operation
cecil copied to clipboard

.NET Framework 4.8.1 - Failed to resolve assembly: netstandard, Version=2.0.0.0

Open fandrei opened this issue 1 year ago • 3 comments

			var resolver = new DefaultAssemblyResolver();
			var asm = resolver.Resolve(new AssemblyNameReference("netstandard", new Version("2.0")));
			var module = asm.MainModule;

This code successfully resolves the assembly when executed from a .NET 6 app, but it fails in a .NET 4.8.1 app:

Failed to resolve assembly: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'

fandrei avatar Mar 26 '23 19:03 fandrei

Missing PublicKeyToken.

pengweiqhca avatar Mar 29 '23 05:03 pengweiqhca

@pengweiqhca that doesn't matter.

fandrei avatar Mar 29 '23 06:03 fandrei

DefaultAssemblyResolver is not able to resolve many assemblies if you check its source code (and BaseAssemblyResolver). You need to add search directories to guide it.

You might read https://github.com/jbevain/cecil/discussions/802 to study a similar case.

lextm avatar Aug 10 '23 07:08 lextm