如何在通用Windows应用程序中访问程序集属性?

时间:2015-11-08 01:16:32

标签: c# attributes uwp

我试图从我的某些程序集的属性中获取值,例如各种版本属性加上一些自定义属性。

当我尝试访问n时,它已经消失了! Assembly.GetExecutingAssembly()似乎只有一种方法System.Reflection.Assembly

那么如何访问我的属性值?

1 个答案:

答案 0 :(得分:4)

我在WinRT中知道检索程序集的唯一方法是通过GetTypeInfo扩展方法。它在命名空间System.Reflection中定义:

using System.Reflection;

...

        foreach (var attribute in this.GetType().GetTypeInfo().Assembly.CustomAttributes)
        {
            Debug.WriteLine(attribute);
        }