May 20 2021 10:21 AM - edited May 21 2021 09:14 AM
Hi!
I wrote a WPF program using .NET 5, packed it into the MSIX bundle (Release, x86 and x64) as a framework-dependent package. Everything seems fine, but there is one very annoying thing: on the first run the app says ".NET runtime is missing, would you like to install it?”. If you click yes, the download page opens, where the user has to select the needed runtime, download, and install it. Not the best user experience, I'm thinking about how to improve it.
Is there an option to add .net 5 runtimes (x86 or x64 depending on the user system, or maybe both) as a dependency so it installed automatically?
I know I can define dependencies, but how can I find the right name for the needed dependency?
Also, I know it's possible to define custom install action but I haven't tried it yet, because I want to find a simpler solution. Looks like for that option I'll have to create a small app or script that will check if the needed runtime exists and if not - check the platform and ask the user to install the specific version of the runtime. Not the best user experience too.
Of course, I still have an option to go with self-contained, but I don't want to distribute so many megabytes of .net every time, especially given the fact that I expect frequent updates.
May 24 2021 04:13 AM
May 24 2021 08:29 AM
@levyas I haven't replied as I don't know the package name you'd need. But ultimately, the AppXManifest file should have it listed as a Dependency package. By listing it in as a dependency there, the system will install the dependency for you from the Windows Store.
The form will be something like this example for the .Net.Native framefwork: "Microsoft.Net.Native.Framework.2.2.2.2.29512.0_x64__8wekyb3dbabbwe"
I would guess you might need both framework and runtime referenced. I'm not using any .NET 5 yet, so I'm not sure. Possibly you can run the PowerShell command
get-appxpackage -PackageTypeFilter Framework
On a system where the sdks are installed and they might show up. You'd want value from the PackageFullName in your appxmanifest dependencies.
If you find the answer, please post back and share!
May 24 2021 08:35 AM
@levyas Adding @Matteo Pagani for possible help.
May 24 2021 08:46 AM
SolutionMay 24 2021 11:07 AM
May 24 2021 11:20 AM
May 25 2021 08:18 AM
Jun 09 2021 06:08 AM
Jun 09 2021 06:15 AM
@Valery Atlas I apologize, I missed the notification about your question. In a .NET 5 scenario, the best to achieve what you're trying to do is to use the self-contained deployment model (https://docs.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained), where the full runtime and all its dependencies will be included inside the package.
Scripts can be executed at the first launch using the Package Support Framework (https://docs.microsoft.com/en-us/windows/msix/psf/run-scripts-with-package-support-framework), but they still run inside the container, so it's not a good way to install dependencies which must be system-wide.
I hope it helps!
Jun 09 2021 06:28 AM
Jun 09 2021 06:34 AM
Jun 09 2021 06:50 AM
Jun 09 2021 07:04 AM
Jun 09 2021 07:19 AM
Jun 09 2021 08:14 AM
Jun 09 2021 08:20 AM
Jun 09 2021 08:35 AM
Jun 09 2021 08:40 AM