I'm developing a WPF application and I would like to add XAML Islands to be able to use windows 10 controls in my app.
Following this tutorial I added the Microsoft.Toolkit.Wpf.UI.XamlHost project via Nuget Package Manager. It also installed it's dependencies, like Microsoft.Windows.SDK.Contracts (10.0.18362.2005), which has a dependency to System.Runtime.WindowsRuntime >= 4.6.0. When I run the project, the following compilation error appeared:
Multiple assemblies with equivalent identity have been imported: 
'C:\Users\*[path to my project]*\packages\System.Runtime.WindowsRuntime.4.6.0\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll'
and 
'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll'.
Remove one of the duplicate references.
Clear error message, the XamlHost installed it's dependencies (it modified the app.config and packages.config files - the exact rows are posted below) and I also have a WindowsRuntime.dll added by default in MyProject.csproj file the following way:
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
    <SpecificVersion>False</SpecificVersion>
    <HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
So I left the dependencies currently installed with XamlHost and removed the default one, what I posted above. Then, when I compiled it threw an error popup that: This application has failed to start because the application configuration is incorrect. I also tried to remove the other import, which was added when I installed the XamlHost project:
So, removed from the app.config the following lines:
<dependentAssembly>
    <assemblyIdentity name="System.Runtime.WindowsRuntime" publicKeyToken="b77a5c561934e089" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
</dependentAssembly>
and from packages.config:
<package id="System.Runtime.WindowsRuntime" version="4.6.0" targetFramework="net471" />
But it threw the same popup, that the project configuration is incorrect.
Also updates to the latest Visual studio (I'm using vs2019 Community), updated to the latest windows SDK, and to the latest .NET Framework.
So, couple of questions:
- Every reference in 
MyProject.csprojfile is added from thepackagesfolder, except thisWindowRuntime, which is from Program Files (path above), why is that not referenced from thepackagesfolder? (Also tried to change it's version to 4.6.0, nothing. Tried to replace the import path and set it to the packages folder, nothing. If I remove it, doesn't even compile the project). - In that path to the 
WindowsRuntime.dllinProgram Fileswhat is that.NetCore\v4.5\, however the latest .NetCore is 3.1? And it contains aWindowsRuntime.dllversion 4.0.0, why? 
What am I doing wrong?