1

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.

Lev
  • 811
  • 12
  • 13
  • BTW I learned about dependencies and actions from this answer https://stackoverflow.com/a/58326092/3087417 but unfortunately, it didn't give me an answer to my question. – Lev May 21 '21 at 14:36

1 Answers1

1

Luckily, I got an answer on techcommunity.microsoft.com

Thanks to Matteo Pagani:

if it's an application based on .NET Core / .NET 5 (as I seem to understand from the description), the suggested and best way to distribuite via MSIX is to use the self-deployment approach. Thanks to MSIX features like differential updates and single disk instance, you don't have to worry too much about the increased size, since the runtime will be downloaded only at the first install.

Dependencies are not a good fit because there are no packages for .net 5 yet.

Custom install actions are possible but more complicated, so I decided to go with self-contained.

Lev
  • 811
  • 12
  • 13
  • Thanks for sharing your experience. Can I please ask how did u configure the MSIX project to use the self-contained publish profile in Visual Studio? – Amir Mahdi Nassiri May 13 '22 at 15:46
  • 1
    Hi @AmirMahdiNassiri, glad it helped. Good question. You need to define publish profile for folder publish for the desired platform, and then: open .wapproj file, find ItemGroup which contains ProjectReference to your app, inside that reference add Properties\PublishProfiles\FolderProfile.pubxml – Lev May 17 '22 at 08:18
  • Thanks for your reply. I do think that the MSIX publish generates its own publish output as I see a folder named `msixpublish` under my publish folders and it looks like to me that the settings we put for the PublishProfile will be ignored as the MSIX packaging project will define its own publishing profile which seems to be self-contained by default. – Amir Mahdi Nassiri May 18 '22 at 21:48
  • Yes, it uses its own default publish profile, which is self-contained indeed. At that time I wanted to make it framework-dependent, and the manual setting of PublishProfile worked for that in my case. – Lev May 19 '22 at 13:29
  • I reckon the msix package will still have to be downloaded in full? It's a bit weird to have a file size of about 150MB for a trivial WPF app that needs downloading on every update. Am I missing something? – John Aug 02 '22 at 19:30
  • To my own comment: Maybe that's indeed more clever than I thought: https://github.com/MicrosoftDocs/msix-docs/issues/142. – John Aug 02 '22 at 19:36