如何从 C++ 获取文件版本信息 C# 中的 exe 吗?

发布于 2024-07-08 04:23:04 字数 176 浏览 9 评论 0原文

我需要从 C# 程序中最初用 C++ 编写的 exe 文件获取文件版本信息。

使用 Assembly.LoadFile(fullpath).GetName().Version 会导致 BadImageFormatException。

有人可以帮忙吗?

干杯,

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

Using Assembly.LoadFile(fullpath).GetName().Version results in a BadImageFormatException.

Can anyone help?

Cheers,

Dan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泼猴你往哪里跑 2024-07-15 04:23:04

添加一个using System.Diagnostics,然后:

    FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);

然后查看info的各种属性:

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

等等

Add a using System.Diagnostics, and then:

    FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);

Then look at the various properties of info:

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

etc

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文