3

I need to get the following information about FileVersionInfo.FileDescription and FileVersionInfo.ProductName for a 64-bit process, is this possible?

When is a 32-bit process I get this way, as if in this, but when is a 64-bit process could not get a way to get this information.

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);
}
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

1 Answers1

1
var versionInfo = FileVersionInfo.GetVersionInfo(yourExePath);
string fileDescription = versionInfo.FileDescription;
string productName = versionInfo.ProductName;
Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189
  • Sure, but that means you have to know the exe path. Is there a way to get the exe path from a Process object that doesn't involve using a [ManagementObjectSearcher](http://stackoverflow.com/a/5497319/771768)? – Carl Walsh Feb 19 '14 at 22:08
  • @CarlWalsh `process.MainModule.FileName` is what you're asking for? – Sriram Sakthivel Feb 20 '14 at 17:57
  • 2
    Thanks, but user3061673 was asking about getting the info of a 64-bit process from a 32-bit process. And the [MSDN](http://msdn.microsoft.com/en-us/library/system.diagnostics.process.mainmodule(v=vs.110).aspx) specifically says that `MainModule` with throw if "A 32-bit process is trying to access the modules of a 64-bit process." – Carl Walsh Feb 20 '14 at 19:44