如何为我的程序集创建自定义属性?

How can I create a custom Property for my assembly?(如何为我的程序集创建自定义属性?)

本文介绍了如何为我的程序集创建自定义属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为我的 .Net 程序集创建自定义属性,然后在 Windows 资源管理器的详细信息"选项卡下可以看到该属性?

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

更新:引用我对 Lars 的评论...虽然我希望在 Visual Studio 中执行此操作,但这当然不是我的首要任务.实际上,我希望将任何解决方案集成到现有的 nant 构建过程中.所以影响编译后的程序集是完全可以接受的.你听说过这样的工具吗?"

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...

推荐答案

你的编译器不支持.AssemblyFileVersionAttribute 和所有工作,因为编译器在您的程序集中生成一个名为 VERSIONINFO 包含该信息.这就是windows正在阅读的内容.其他属性只是与您的代码一起保存为元数据.

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.

您可以在编译后制作一个工具来更改 VERSIONINFO 资源.

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

这篇关于如何为我的程序集创建自定义属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何为我的程序集创建自定义属性?

基础教程推荐