Get Version from Non Executing Executable File

前端 未结 1 1630
广开言路
广开言路 2021-01-18 12:58

I know how to get the version of an executing application or dll. However I need to find the properties of a non executing application.

I have a small program to

相关标签:
1条回答
  • 2021-01-18 13:08

    You can use FileVersionInfo.GetVersionInfo():

    FileVersionInfo vi = FileVersionInfo.GetVersionInfo("myfile.dll");
    

    string showVersion = vi.FileVersion;

    //showVersion is the actual version No.

    This returns file/document metadata and can be used for unmanaged DLLs or even word documents as well.

    You can also use Assembly:

    Version v = Assembly.ReflectionOnlyLoadFrom("myfile.dll").GetName().Version;
    

    This will contain .NET version information.

    0 讨论(0)
提交回复
热议问题