How to get file version information from C ++ exe in C #?

I need to get file version information from an exe file originally written in C ++ from a C # program.

Using Assembly.LoadFile (fullpath) .GetName (). The result of the version is a BadImageFormatException exception.

Can anyone help?

Greetings

Dan

+3
source share
1 answer

Add using System.Diagnosticsand then:

    FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);

Then review the various properties info:

    Console.WriteLine(info.CompanyName);
    Console.WriteLine(info.ProductName);
    Console.WriteLine(info.LegalCopyright);
    Console.WriteLine(info.ProductVersion);

etc.

+6
source

Source: https://habr.com/ru/post/1699100/


All Articles