Pretty sure this is more a misunderstanding/lack of documentation than an issue with NuGet itself...
I'm trying to build a nuget package that provides different assemblies for different target runtimes and frameworks. In particular I need to target win/net461 and osx/netcoreapp2.0.
My understanding is that assemblies can be included in the package in the following folders for per-runtime installation:
~
/runtimes/{rid}/lib/{tfm}/
~
So I'm including files like so:
~
/runtimes/win/lib/net461/myassembly.dll
/runtimes/osx/lib/netcoreapp2.0/myassembly.dll
~
When the resulting nuget package is added to a project however the reference to myassembly.dll isn't added to the target project.
Tested with VS UI, NuGet version 4.6.0, dotnet.exe --version = 2.1.402, VS version: 15.8.4, OS version: Win 10
There's a sample project here.
Associated Stack Overflow question here.
Please refer https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks to understand how to create NuGet packages for multi TFMs as well as multiple architectures or runtimes.
I've already seen that article and all it says is that architecture specific assemblies should be placed in the "/runtimes/" folder, which is what I've done and they're not being added to the target project.
It's not obvious from that article if there also needs to be assemblies in the regular '/lib/' folder nor any mention of the '/refs/' folder (for which I haven't been able to find any documentation). If there's something else required to make it work then that article doesn't mention it. It doesn't even mention the rid graph, nor provide any link to it.
Whatever is need to make this work doesn't seem to be documented properly anywhere.
So the question remains: should assemblies in the /runtimes/ folder be automatically added to the target project and if not what else is required to make it work?
So it turns out the the documentation for this is woeful. Is there not one piece of official documentation on the /ref folder and the fact that .NET Framework projects don't seem to use the /ref and /runtime folders at all?
See my answer to the original stackoverflow question for how I'm guessing it works: https://stackoverflow.com/a/52471739/77002
@toptensoftware I didn't realize that those documents are not up to date for defining runtime assemblies and don't mention anything about /ref to define compile time dependencies. I also saw couple of doc issues for the similar scenario.
So I'll keep this issue as tracking issue to update the docs on priority to explain ref
runtime
and lib
folders to define multi tfm across multi architecture/ os libraries.
Related docs issues:
https://github.com/NuGet/docs.microsoft.com-nuget/issues/962
https://github.com/NuGet/docs.microsoft.com-nuget/issues/880
https://github.com/NuGet/docs.microsoft.com-nuget/issues/600
Relevant source of information for anyone to pick this item to work in future:
https://stackoverflow.com/questions/52397501/nuget-references-to-assemblies-in-runtimes-folder-not-added
https://github.com/NuGet/Home/issues/1221
Doc updates in master branch, It will be live in few days.
Most helpful comment
I've already seen that article and all it says is that architecture specific assemblies should be placed in the "/runtimes/" folder, which is what I've done and they're not being added to the target project.
It's not obvious from that article if there also needs to be assemblies in the regular '/lib/' folder nor any mention of the '/refs/' folder (for which I haven't been able to find any documentation). If there's something else required to make it work then that article doesn't mention it. It doesn't even mention the rid graph, nor provide any link to it.
Whatever is need to make this work doesn't seem to be documented properly anywhere.
So the question remains: should assemblies in the /runtimes/ folder be automatically added to the target project and if not what else is required to make it work?