如何从64位进程C#获取fileversioninfo

时间:2013-12-03 13:43:13

标签: c# process

对于64位进程,我需要获取有关FileVersionInfo.FileDescriptionFileVersionInfo.ProductName的以下信息,这可能吗?

什么时候是32位进程,我就是这样,就好像在这里,但64位进程什么时候无法获得这些信息。

if (32BitProcess)
{
    descricaoArquivo = Process.MainModule.FileVersionInfo.FileDescription;
    nomePrograma = Process.MainModule.FileVersionInfo.ProductName;
}
else
{
    nomePrograma = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
    descricaoArquivo = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().FullName);
}

1 个答案:

答案 0 :(得分:0)

var versionInfo = FileVersionInfo.GetVersionInfo(yourExePath);
string fileDescription = versionInfo.FileDescription;
string productName = versionInfo.ProductName;