how to read the assembly manifest without loading the .dll

前端 未结 6 1374
南旧
南旧 2021-01-05 21:34

Essentially need to read the dependencies programmatically without loading the assembly itself, as then you can\'t unload them

6条回答
  •  再見小時候
    2021-01-05 22:08

    Use DnSpy (it won't load the dll in your program):

            var assemblyDef = dnlib.DotNet.AssemblyDef.Load("myDllName.dll");
            var manifest = assemblyDef.ManifestModule; // do whatever you want from here
    

    ref: https://www.nuget.org/packages/dnSpyLibs

    I did a blog post on that: https://medium.com/angular-and-dot-net/reading-assembly-info-without-loading-it-in-c-31a4bea7ef73

提交回复
热议问题