Comment puis-je obtenir des informations sur la version du fichier à partir d'un fichier exe C ++ en C #?

StackOverflow https://stackoverflow.com/questions/261629

Question

Je dois obtenir les informations sur la version du fichier d'un fichier exe écrit à l'origine en C ++ à partir d'un programme C #.

Utilisation de Assembly.LoadFile (chemin complet) .GetName (). La version génère une exception BadImageFormatException.

Quelqu'un peut-il aider?

A bientôt,

Dan

Était-ce utile?

La solution

Ajoutez un à l'aide de System.Diagnostics , puis:

    FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);

Regardez ensuite les différentes propriétés de info :

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

etc

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top