Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should assemblies in /runtimes/{rid}/lib/{tfm} be added as references to target project? #7316

Closed
toptensoftware opened this issue Sep 21, 2018 · 5 comments
Assignees
Labels
Priority:1 High priority issues that must be resolved in the current sprint. Style:PackageReference Type:Docs
Milestone

Comments

@toptensoftware
Copy link

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.

@toptensoftware toptensoftware changed the title Should assemblies in /runtimes/{rid}/lib{tfm} be added as references to target project? Should assemblies in /runtimes/{rid}/lib/{tfm} be added as references to target project? Sep 21, 2018
@jainaashish
Copy link
Contributor

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.

@jainaashish jainaashish added the Resolution:Question This issues appears to be a question, not a product defect label Sep 21, 2018
@toptensoftware
Copy link
Author

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?

@toptensoftware
Copy link
Author

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

@jainaashish
Copy link
Contributor

@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
#1221

@jainaashish jainaashish added Type:Docs Style:PackageReference Priority:1 High priority issues that must be resolved in the current sprint. and removed Resolution:Question This issues appears to be a question, not a product defect labels Sep 24, 2018
@jainaashish jainaashish added this to the 4.9 milestone Sep 24, 2018
@jainaashish jainaashish self-assigned this Oct 10, 2018
@jainaashish
Copy link
Contributor

Doc updates in master branch, It will be live in few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:1 High priority issues that must be resolved in the current sprint. Style:PackageReference Type:Docs
Projects
None yet
Development

No branches or pull requests

3 participants