GetCustomAttribute() returns null for AssemblyVersionAttribute

前端 未结 3 1469
太阳男子
太阳男子 2021-01-07 17:42

I\'m adding an About dialog to my .NET application and I\'m querying the assembly\'s attributes for information to display. When I attempt to retrieve my assembly\'s Assembl

3条回答
  •  爱一瞬间的悲伤
    2021-01-07 18:31

    Your example is not a work-around. It's exactly what the MSDN documentation states you should do, which leads me to believe that code is by-design.
    http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx

    To get the name [sic] of an assembly you have loaded, call GetName on the assembly to get an AssemblyName, and then get the Version property. To get the name of an assembly you have not loaded, call GetAssemblyName from your client application to check the assembly version that your application uses.

提交回复
热议问题