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

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.

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)