How can I create a custom Property for my assembly?

只谈情不闲聊 提交于 2019-11-27 02:21:15

问题


How can I create a custom property for my .Net assembly which would then be visible under the Details tab in Windows explorer?

Something to sit parallel with "File Description", "Type", "Product Version"... etc

Update: To quote my comment to Lars ... "Whilst I would have liked to do this from within Visual studio, that is certainly not my priority. Actually I hope to integrate any solution into an existing nant build process. So affecting the assemblies post compile is entirely acceptable. Have you ever heard of such a tool?"

Further Update: I'm not sure if what I'm talking about is an attribute or not, to clarify a little what I would like to creat in an entry in the following property page...


回答1:


Your compiler does not support it. AssemblyFileVersionAttribute and all work because the compiler generates a win32 resource in your assembly called VERSIONINFO with that information in it. That is what windows is reading. Other attributes are just saved as metadata along with your code.

You could make a tool to change the VERSIONINFO resource after you compile.




回答2:


Its not the answer yet, but one 1/2 way hack is to use:

[assembly: AssemblyDescription("One Line of Content Here")]

And that shows up under "Comments".

(still researching, this is something I've wanted for a while.)




回答3:


The only tool that can control any field of VERSIONINFO structure from the command line and hence is able to add an additional property during a build process is Resource Tuner Console:
http://www.reseditor.com/rtc-solution-version-info.htm

The $199 price seems a bit high... but if you don't want to spend days mucking around with C/C++ then it's a steal.



来源:https://stackoverflow.com/questions/191812/how-can-i-create-a-custom-property-for-my-assembly

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