Detecting Windows App SDK version at runtime #2796
-
If I have a Windows App SDK 1.1 app, is there a reliable way to determine which version of the runtime is being used? Obviously, it will be 1.1.x release, but I'd like to know precisely if it is 1.1.1 or 1.1.2 or 1.1.3 etc. I can't seem to find an obvious way of doing this, and it would be very helpful for analytics/bug-tracking purposes. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 20 replies
-
You can see this similar question : Recommended way to check that the Windows App SDK is installed |
Beta Was this translation helpful? Give feedback.
-
Yes. Do you want the version of the MSIX packages? Or the version of the WinAppSDK release (1.1.3, etc)? For the former, walk the current process' package graph looking for the 1st match for the framework package's family name, then the package's version field has the answer. For the latter do same, but then pull out the major version's bottom 3 digits for the patch level e.g. WinAppSDK release 1.1.3 has MSIX packages with version WindowsAppRuntime_IsSelfContained() does this. It's C++ (not C#) but implements this algorithm.
Hmmm. The phrasing may be confusing. The constants via I'm working on a runtime API to complement this build-time API, equivalent-ish to what's exposed by WindowsAppSDK-VersionInfo.* but functions instead of constants. Thus a runtime lookup retrieving values from the runtime binaries currently in use, not what you built with. I hope to have something concrete to share shortly. |
Beta Was this translation helpful? Give feedback.
Yes. Do you want the version of the MSIX packages? Or the version of the WinAppSDK release (1.1.3, etc)?
For the former, walk the current process' package graph looking for the 1st match for the framework package's family name, then the package's version field has the answer.
For the latter do same, but then pull out the major version's bottom 3 digits for the patch level e.g. WinAppSDK release 1.1.3 has MSIX packages with version
1003.x.y.z
. You already know the release's major.minor version you're built with (the '1.1' in '1.1.3') so the MSIX packageversion.major % 1000
…