Cannot get types from .winmd file

前端 未结 3 671
别那么骄傲
别那么骄傲 2021-01-20 08:17

I want to output the types in a .winmd file given its path. I copied a winmd file from my Windows 8 Developer Preview machine to my dev machine. I wrote a small test app (in

3条回答
  •  生来不讨喜
    2021-01-20 09:10

    WinMDs are metadata only assemblies. Using ReflectionOnlyLoadFrom should do the trick.

    The following code works.

            var assembly = System.Reflection.Assembly.ReflectionOnlyLoadFrom(winmdPath);
    
    
            foreach (var type in assembly.GetTypes())
            {
                Console.WriteLine("type found name = " + type.Name);
            }
    

提交回复
热议问题