0

As the question states, how do I edit assembly information of a compiled executable file using Mono.Cecil? I tried to use FileVersionInfo but it is Read Only and I came to know that there is a possibility with Mono.Cecil/dnlib.

Ravi Kiran
  • 565
  • 1
  • 8
  • 22

1 Answers1

0

I am aware that the question is already a few months old, however, I post my answer anyways, maybe someone can profit from it in the future.

First of, dnlib/Mono.Cecil doesnt't yet have an inbuilt feature to modify the AssembyInfo of a .NET executable file or a DLL.

However I can recommend you to use resourcelib from Daniel Doubrovkine.

It was exactly created for this purpouse. Here is an example of how to use it:

VersionResource versionResource = new VersionResource();
versionResource.LoadFrom("C:\\MyFile.exe");

StringFileInfo stringFileInfo = (StringFileInfo)versionResource["StringFileInfo"];

versionResource["StringFileInfo"];
stringFileInfo["CompanyName"] = "My Company";
stringFileInfo["FileDescription"] = "This is a file";
stringFileInfo["ProductName"] = "My awesome product";
stringFileInfo["LegalCopyright"] = "Copyright Me";

You can save your changes like this :

versionResource.SaveTo("C:\\MyFile-patched.exe");
yq8
  • 145
  • 1
  • 10