NuGet: references to assemblies in runtimes folder not added

  • A+
Category:Languages

I have a project that targets two different operating systems/frameworks:

  1. net461 on Windows and
  2. netcoreapp2.0 on OSX

I'm trying to figure out how to correctly package this for NuGet. According to this post I should be able to package them like this:

/runtimes/win/lib/net461/myassembly.dll /runtimes/osx/lib/netcoreapp2.0/myassembly.dll 

By when I add the NuGet package to another project, the packaged assemblies aren't added as references to the target project.

Then I read somewhere that you also need to add reference libraries to the /ref folder so I tried this:

/runtimes/win/lib/net461/myassembly.dll /runtimes/osx/lib/netcoreapp2.0/myassembly.dll /ref/net461/myassembly.dll /ref/netcoreapp2.0/myassembly.dll 

In this case the assemblies get added as a reference to the target project and I can build it, but the required assemblies aren't copied to the output folder.

The documentation on all this is extremely vague and I'm fairly lost.

What am I missing?


Associated NuGet Issue: https://github.com/NuGet/Home/issues/7316


Update: I've put together a sample project that demonstrates what I'm trying to achieve. In particular see the bottom of the readme, titled "NuGet Packaging".

 


Can you try to target .NET Standard 2.0 instead of net461 and netcoreapp2.0? Libraries built against netstandard2.0 should work with .NET Core 2.0 and .NET Framework 4.6.1: https://docs.microsoft.com/en-us/dotnet/standard/net-standard

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: