Question

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?

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?

The code does not work

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

Solution

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.

The final command line needed was

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top