Forum Discussion
levyas
May 20, 2021Brass Contributor
MSIX: How to achieve automatic install of .net 5 required for my application?
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 ...
- May 24, 2021Hello, 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.
Otherwise, if you don't like self-deployment, you will need to use a script to pre-install the runtime. You can leverage some of the available script we release for CI/CD purposes here: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
I hope it helps!
Matteo Pagani
Microsoft
Jun 09, 2021Telemak68 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!
Telemak68
Jun 09, 2021Copper Contributor
Hi Matteo,
Thanks for your considerations.
The self-contained deployment model seems to have significant security related issues and may require regular patches from ISVs. This is what Microsoft Tech Support experts mentioned in their reply to my inquiry about deploying ..NET and Asp.NET components. They said that the global distribution of these prerequisites is the most reliable option that has a number of advantages, If you wish, I can share with you our email exchange.
This is why I would like to concretize how to deploy the redistributable packages, such as .NET, Asp..NET or .NET SDK. Running a script using PSF seems to be quite problematic because deployment of these prerequisites will require elevation. Is it possible to add the .NET 5 and ASP..Net references as Dependency packages to the AppXManifest file?
Thanks for your suggestions!
Thanks for your considerations.
The self-contained deployment model seems to have significant security related issues and may require regular patches from ISVs. This is what Microsoft Tech Support experts mentioned in their reply to my inquiry about deploying ..NET and Asp.NET components. They said that the global distribution of these prerequisites is the most reliable option that has a number of advantages, If you wish, I can share with you our email exchange.
This is why I would like to concretize how to deploy the redistributable packages, such as .NET, Asp..NET or .NET SDK. Running a script using PSF seems to be quite problematic because deployment of these prerequisites will require elevation. Is it possible to add the .NET 5 and ASP..Net references as Dependency packages to the AppXManifest file?
Thanks for your suggestions!
- Matteo PaganiJun 09, 2021
Microsoft
No, unfortunately that's not possible. The Dependencies section of the manifest supports only a very specific subset of packages created by the Windows team, like VC++ libraries or the Project Reunion framework. .NET and ASP.NET aren't supported dependencies. I'm afraid that, if you want to go with MSIX, your best option is to use self-contained. I don't fully agree that the self-contained model has significant security issues but, for sure, it requires the ISV to own the patching and updating of the runtime (which might make things complicated in big enteprise environment, where a new version of the app must be deployed to all the devices in the company).- Telemak68Jun 09, 2021Copper ContributorWell, this seems to be a significant limitation. Why are VC++ libraries or the Project Reunion framework supported for such a distribution, whereas .NET prerequisites cannot be added to this "very specific subset of packages"?
As you mentioned, a self-containing deployment model does make things complicated in a big enterprise environment, this is why it would be very advantageous to provide the support for distribution of .NET prerequisites using the Dependencies section of the manifest. Why .NET prerequisites have a different status compared with VC++ runtime and what are the main obstacles for adding the to the subset of the supported packages?
As long as this support is not provided, how to use the script related alternative mentioned in your message? Script will require elevation, and this will mean that the ;main app in the MSIX package will be launched prior to completing the script execution. Can you please shed some light on this alternate option or, perhaps, provide a simple example?- Matteo PaganiJun 09, 2021
Microsoft
Yours is a good question, but I don't really have an answer unfortunately. .NET uses different distribution channels for their runtimes, and they aren't currently distributed as MSIX, therefore they aren't available as dependencies.
As I mentioned in the other comment, the scripting option wouldn't be a good fit here. Since the script is executed inside the same container of the MSIX packaged app, this feature isn't a good fit for dependencies which must be installed system wide (like the .NET runtime) and with administrative rights.
Unfortunately, out of the box, I can't think of an easy solution for your scenario other than using self-contained deployment. Sorry!