如何按名称加载WinRT程序集? 当我执行以下操作时:
```csharp Assembly.Load("MyWinRtComponent, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") ```
它会抛出异常:未能找到程序集 'MyWinRtComponent'。
然后它显示“操作不支持”。即使我这样做,也会出现这种情况:
```csharp Assembly.Load("MyWinRtComponent, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") ```
它会抛出异常:未能找到程序集 'MyWinRtComponent'。
(new TextBlock()).GetType().GetTypeInfo().Assembly
然后我获取了 Windows.UI.Xaml.Controls 的程序集。但是如果我尝试通过名称加载它:
var name = new AssemblyName {
Name = "Windows.UI.Xaml.Controls",
Version = new Version(255, 255, 255, 255),
ContentType = AssemblyContentType.WindowsRuntime
};
然后它显示“操作不支持”。即使我这样做,也会出现这种情况:
var name = (new TextBlock()).GetType().GetTypeInfo().Assembly.GetName();
Assembly.Load(name);
我如何通过名称获取WinRT程序集?