Could not load file or assembly ‘System.Private.CoreLib
This post to help those that are facing the following error when trying to install an UWP - Desktop Bridge .NET application:
Exception type: System.IO.FileNotFoundException
Message: Could not load file or assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
This error occurs because Microsoft Store no longer accepts packages with mixed UWP and Desktop .NET binaries that have not been created with the proper packaging project (Visual Studio Packaging Project). This is to ensure the UWP binaries get the proper .NET native compile in the cloud (which is not applicable to the Desktop .NET binaries).
To package an UWP App with a Win32 extension, consider to use the new Visual Studio Packaging Project template, and then create the Store package out of that project in VS.
If your Win32 EXE is not built in VS and you just want to include the binary in your UWP project you should still use the Packaging project. Make sure the Win32 EXE gets dropped into a subfolder of the package. See screenshot below for this type of project structure.
Details are in the following blog posts:
Example #3 for this specific case:
Package a .NET desktop application using the Desktop Bridge and Visual Studio Preview
Sideload Scenario
To install the App in a sideload scenario (without use Microsoft Store), it is necessary to install the corresponding AppPackages folder that has the “_Test” suffix and install the appxbundle that is in that folder, since the assemblies in the .appxupload generated by VS (in all projects) are IL, not yet compiled with .NET Native.
Don't forget to double-check if the App is compiled in Release mode with .NET native compilation enabled.
For more info/examples, look here:
https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/
https://blogs.windows.com/buildingapps/2017/12/04/extend-desktop-application-windows-10-features-using-new-visual-studio-application-packaging-project/ (see example #3)
I hope it helps.