I'm working on a lib (MyLib) that targets .net standard 2.0 and .net core app 3.0. The Lib has a dependency (PrimaryDependency), which in turn has another dependency (OtherDependency), and OtherDependency uses the Microsoft.Windows.Compatibility package:
MyLib
PrimaryDependency
OtherDependency (.NET Std 2.0, using Microsoft.Windows.Compatibility Nuget package)
I wrote two test apps using MyLib. One built on the .net 4.72, one for .netcoreapp 3.1. The net472 test app does not need anything from Microsoft.Windows.Compatibility (all that stuff is in the .NET runtime). So, the output does contain Tester.exe, MyLib.dll, PrimaryDependency.dll and OtherDependency.dll and it works just fine.
The .netcore test app output contains Tester.exe, Tester.dll, MyLib.dll, PrimaryDependency.dll, OtherDependency.dll and a bunch of System.* and Microsoft.* dlls (the parts from Microsoft.Windows.Compatibility that is needed to run the app), and it works fine, too.
Now, if I compile (or publish) MyLib.dll, neither the netstandard2.0 output nor the netcoreapp3.0 output does contain the System.* and Microsoft.* dlls that are needed for MyLib.dll to operate on .net core.
As MyLib.dll is a plugin, the final consumer of this dll does not have the MyLib project as a reference, and hence, the System.* and Microsoft.* dependencies go missing. What can I do to ensure when I compile/publich MyLib, that it does contain all the necessary dependencies?