C# 阅读汇编的作者
读取程序集的一些元数据非常容易,只需加载C# 阅读汇编的作者,c#,.net-core,attributes,metadata,.net-assembly,C#,.net Core,Attributes,Metadata,.net Assembly,读取程序集的一些元数据非常容易,只需加载程序集,然后获取自定义属性,例如: Assembly assembly = Assembly.GetExecutingAssembly(); AssemblyTitleAttribute? attribute = assembly.GetCustomAttribute<AssemblyTitleAttribute>(); string? title = attribute?.Title; Assembly=Assembly.getExecut
程序集
,然后获取自定义属性,例如:
Assembly assembly = Assembly.GetExecutingAssembly();
AssemblyTitleAttribute? attribute = assembly.GetCustomAttribute<AssemblyTitleAttribute>();
string? title = attribute?.Title;
Assembly=Assembly.getExecutionGassembly();
汇编标题属性?attribute=assembly.GetCustomAttribute
你知道为什么这个属性会丢失,以及如何读取它的值吗?(我使用的是dotnet标准2.1)对于作者
没有程序集属性
,也不能通过反射或shell查询它32
AssembyInfo属性和作者的列表不在其中
根据问题中更新的屏幕截图,您指的是Project>Properties>Package
view,您在这里看到的字段是AssemblyInfo和Nuget元数据属性的混合体
诸如版权
和说明
之类的属性对于这两种属性都是通用的
其中,PackageId
、Authors
、PackageVersion
等属性是无法从程序集查询的Nuget元数据属性。
Nuget元数据属性是用作打包过程输入的属性列表
为什么在Project>Properties>Package
中甚至有作者作为字段
- 它可以作为nuget.org显示作者姓名的参考
来自博士
作者:以分号分隔的包作者列表,与nuget.org上的配置文件名称匹配。这些将显示在NuGet中
nuget.org上的图库,用于交叉引用
同样的作者
参考文献:
:
我右键单击了.net exe,但找不到作者,我还在“项目属性”>“应用程序”>“程序集信息”中搜索了作者,但在那里找不到either@Clint请参见我的更新(添加的屏幕截图)@Bidou这些设置是针对软件包的,而不是针对生成的程序集。你不能用Assembly
来阅读它。好吧,老实说,我不认为Nuget包和Assembly的混合是一个明智的想法。。。这有点令人困惑!