在 .Net 中构建后更改程序集属性值
我想在构建完成后将程序集属性(如 AssemblyTitleAttribute 值)更改为其他值。这可能吗?
只是我们有两种类型的构建,一种是基础构建,另一种是混淆构建,因此我们只想对标题/属性值添加一些更改,而不需要重新构建程序集。
I want to change the assembly attribute like AssemblyTitleAttribute value to something else once the build is done. Is this possible?
Its just that we have two types of builds one is base and the other is obfuscated, so we just want to add some changes to title / attribute values without rebiulding the assemblies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 ildasm 将程序集转换为 IL,更改其中的属性值并使用 ilasm 重新创建程序集。这可能被认为是重建,也可能不被认为是重建。
但是,基于构建的顶部有条件地编译项目中的程序集属性的内容可能同样简单快捷。开发人员可能更熟悉这种方法,而且恕我直言,它更容易维护。
You could use ildasm to convert the assembly to IL, change the attribute value there and use ilasm to recreate the assembly. This may or may not be considered rebuilding.
However, it's likely just as easy and fast to conditionally compile the contents of the Assembly attributes in your project based on the top of the build. Developers are likely to be more familiar with this method and it's, IMHO, easier to maintain.