Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 阅读汇编的作者_C#_.net Core_Attributes_Metadata_.net Assembly - Fatal编程技术网

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的混合是一个明智的想法。。。这有点令人困惑!