Right now I've got a UWP app that is crashing in different places on different platforms and Win10 versions, and so far only one of them provided a somewhat actionable error message about Microsoft.NET.CoreRuntime.1.1
missing, and that the developer should be contacted about it.
I've seen some articles outlining ways to do stuff related to this manually, but I have to imagine that's not the intended workflow from within Visual Studio.
Iff I know what Minimum version of Windows to target and all the platforms I'm going to support, shouldn't my app or its generated manifest determine what dependencies are required and provide me the option to automatically package them? If so, how? CLI examples are preferred but Visual Studio answers will suffice.
It doesn't make sense that the Store Apps automatically install everything needed, but I need the consumers of my sideload app to run this powershell script Add-AppDevPackage.ps1
each time to ensure no dependencies are missing.
At this time, this is currently not possible to accomplish but that's okay. Pretty much only thing you can do at the moment is use the powershell script or manually handle your dependency packages. That said, the powershell script is more flexible than indicated on similar Q&As. For example, this answer makes it appear more complicated than it needs to be:
... If you want to install the app using PowerShell, you still need to install the dependencies. You can use the Add-AppxPackage cmdlet to add a signed app package to a user account and use the DependencyPath parameter to add all other packages that are required for the installation of the app package. See the topic Add-AppxPackage and the Example 1: Add an app package to install the app and dependencies.
Add-AppxPackage -Path "C:\Users\user1\Desktop\MyApp.appx" -DependencyPath "C:\Users\user1\Desktop\Microsoft.NET.CoreRuntime.2.1.appx"
You don't need to directly point to your dependencies at all, ie you don't even need to use the -DependencyPath
switch if you run the powershell script from your generated \AppPackage\
directory like below:
All you need to do is just run the script directly and not only do your dependencies install, so does your app.
When should I build an .AppXBundle instead of an .AppX and vice-versa?
Please check Types of app packages:
.appx is a file that contains your app in a format that can be sideloaded on a device. Any single app package file created by Visual Studio is not intended to be submitted to Partner Center and should be used for sideloading and testing purposes only.
An app bundle is a type of package that can contain multiple app packages, each of which is built to support a specific device architecture. For example, an app bundle can contain three separate app packages for the x86, x64, and ARM configurations. App bundles should be generated whenever possible because they allow your app to be available on the widest possible range of devices.
So, if your app would not be published to MS store, you just want to sideload it. You could use .appx file.
How can I make sure my app downloads and installs whatever dependencies are missing from the system that's installing it?
@Breeze has replied this question on this thread How to add Microsoft.NET.CoreRuntime.2.1 for UWP package installer?. If the users install your app from MS store, store will automatically install the dependencies that your app need but are not installed. If they're sideloading it, they will need to install the dependency manually. These Dependencies are in the Dependencies folder which is contained in your package folder.
How can I ensure my dependencies are packaged and installed directly from the app package instead of being downloaded later?
According to @Breeze's reply, if you publish your app package to MS store and let your users install the app from MS store, the store will automatically install the dependencies. These dependency packages should not be attached to someone app package. It should be installed on OS, other apps also may need it.