0
我试图从我的程序集的某些属性中获取值,例如各种版本属性加上一些自定义属性。如何在通用Windows应用程序中访问装配属性?
当我尝试访问Assembly.GetExecutingAssembly()
时,它消失了!似乎只有一种方法,Load()
。
那么如何访问我的属性值?
我试图从我的程序集的某些属性中获取值,例如各种版本属性加上一些自定义属性。如何在通用Windows应用程序中访问装配属性?
当我尝试访问Assembly.GetExecutingAssembly()
时,它消失了!似乎只有一种方法,Load()
。
那么如何访问我的属性值?
我知道在WinRT中检索程序集的唯一方法是通过GetTypeInfo
扩展方法。它在命名空间System.Reflection
中定义:
using System.Reflection;
...
foreach (var attribute in this.GetType().GetTypeInfo().Assembly.CustomAttributes)
{
Debug.WriteLine(attribute);
}