VB.Net - What is the difference between AssemblyFileVersion & AssemblyFileVersionAttribute and AssemblyVersion & AssemblyVersionAttribute

此生再无相见时 提交于 2020-01-03 15:55:10

问题


I've inherited a VB.Net codebase which was VB 2005 and upgraded to VB 2008 consisting of around 100 projects

I'm trying to re-version all of the components but have discovered some of the AssemblyInfo.vb files have an AssemblyFileVersion entry and some have an AssemblyFileVersionAttribute entry.

Also, some have an AssemblyVersion entry and some have an AssemblyVersionAttribute entry.

What is the difference between with and without Attribute?

Which ones should I be using?


回答1:


There is no difference. Just as int will resolve to System.Int32, any type derived from Attribute is treated specially by the compiler. So...

[MyCustom] will resolve to [MyCustomAttribute]

Relavent MSDN Entry

By convention, all attribute names end with the word "Attribute" to distinguish them from other items in the .NET Framework. However, you do not need to specify the attribute suffix when using attributes in code. For example, [DllImport] is equivalent to [DllImportAttribute], but DllImportAttribute is the attribute's actual name in the .NET Framework.




回答2:


AssemblyFileVersion and AssemblyFileVersionAttribute etc are the same thing and you can use either one. Here's a response from Microsoft on their connect website about this.



来源:https://stackoverflow.com/questions/3109848/vb-net-what-is-the-difference-between-assemblyfileversion-assemblyfileversio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!