ILASM没有设置FileVersion [英] ILASM does not set FileVersion

查看:115
本文介绍了ILASM没有设置FileVersion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.il文件,可以毫无问题地进行编译.我可以强力命名,因此没有任何问题.但是我无法像我期望的那样通过属性设置文件版本.使用ilasm时如何设置程序集的FileVersion?

I have an .il file which I can compile without any problems. I can strong name it and so without any issues. But I am not able to set the file version via the attribute as I would expect it. How can I set the FileVersion for an assembly when using ilasm?

如果进行往返旅行,我将始终得到一个.res文件,该文件只包含不可读的二进制数据.此res文件里面有什么,我可以对其进行编辑吗?

If I do a round trip I get always a .res file which does contain only binary data which is not readable. What is inside this res file and can I edit it?

代码不起作用

.assembly myAssembly 
{
  .custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = { string('1.2.3.4') }

推荐答案

可以使用.res文件解决此问题.与ildasm和ilasm进行往返旅行是不够的. IL文件未引用.res文件.我必须手动将其添加到ilasm调用中. res文件中的数据似乎包含写入PE标头中的信息,这对我来说是可以的.

The issue can be solved by using the .res file. It is not sufficient to do a round trip with ildasm and ilasm. The IL file does not reference the .res file. I had to add it to the ilasm call manually. The data in the res file seemed to contain the infos which are written into the PE header which is ok for me.

所需的最终命令行是

ilasm test.il /dll /res:test.res

我仍然不知道res文件中到底有什么,但是我可以将其与我手动创建的任何其他assemlby的元数据信息进行交换,然后根据需要对其进行反编译以替换原始程序集的元数据.

I still do not know what exactly is inside the res file but I can exhange it with the meta data information of any other assemlby that I create manually and then decompile it to replace the metadata of the original assembly as I need.

似乎没有多少人在做这样的事情.

It seems not many people are doing such stuff.

这篇关于ILASM没有设置FileVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆