Is Windows App SDK Full Version Number (e.g. 1.5.4) stored somewhere in the assemblies/DLLs? #4511
Replies: 2 comments 3 replies
-
Why do you want to know this.
The above is an example, showing a check for version 2 of the WinUI contract. If you want to force a certain minimum version, just make sure that the version you want as the minimum is the one referenced as the NuGet package. For unpackaged applications, the auto bootstrapper will use the NuGet package version as the minimum version.
For packaged applications, this will set the minimum version in the PackageDependency.
If you really need to dynamically query the Windows App SDK version after all of this, then as far as I know, the only option is to check your application's dependent packages. The annoyance with this is that this is awkward if your application is unpackaged. Windows.ApplicationModel.Package.Current will fail, so you can't get access to the dependencies that way. I believe that GetCurrentPackageInfo, maybe GetCurrentPackageInfo2 from the Windows API is the only way to do this. You must also be sure to specify the PACKAGE_FILTER_DYNAMIC flag. This will also not get a nice 1.5.4 or anything like this, it will get a version in the form of the MinVersion. Of course, if there is a neater way to check this in C#, then I hope you find it. |
Beta Was this translation helpful? Give feedback.
-
Version checking is sometimes necessary and desired. For example, we want to add telemetry to our crash analytics for which version of the Windows App Runtime is being used. Since we're a packaged app if we're specifying a 1.5.2 dependency we can be auto-updated to 1.5.4. This happened to us and 1.5.4 introduced a slew of new crashes |
Beta Was this translation helpful? Give feedback.
-
A simple question:
Is the Full Version Number (e.g. 1.5.4) of Windows App SDK stored somewhere in the assemblies/DLLs?
I only found 1.5 but not 1.5.4. Is the third digit stored somewhere in the assemblies/DLLs so that I can fetch it in C#?
Edit: AssemblyInfo.cs has only these:
Beta Was this translation helpful? Give feedback.
All reactions