79550828

Date: 2025-04-02 13:56:33
Score: 0.5
Natty:
Report link

Thank you Jon. That was very helpful.

public void CheckApi(string apiName, ref Int64 apiVersion)
{
  Int64 v1 = FileVersionInfo.GetVersionInfo(apiName).FileMajorPart;
  Int64 v2 = FileVersionInfo.GetVersionInfo(apiName).FileMinorPart;
  Int64 v3 = FileVersionInfo.GetVersionInfo(apiName).FileBuildPart;
  Int64 v4 = FileVersionInfo.GetVersionInfo(apiName).FilePrivatePart;

  apiVersion = (v1 << 48) | (v2 << 32) | (v3 << 16) | v4;
}

This returns the File Version which for my purposes will always be the same as the Product Version. For anyone who really needs the Product Version there are also four properties to get that info ProductMajorPart, ProductMinorPart, ProductBuildPart, and ProductPrivatePart.

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Gary