简体   繁体   中英

Use specific version of nuget package assemblies

I have the following setup:

A nuget package with two folders: net45 - including assemblies AssemblyOne.dll and AssemblyTwo.dll netstandard1.3 - including assemblies AssemblyOne.dll and AssemblyTwo.dll Of course these are different files with the same name.

I install the package into a project targeting 4.6.1 version of .NET Framework.

How can I make sure the assemblies from the netstandard1.3 are added to this project? Right now the net45 ones are added.

Thanks!

This is not supported with NuGet. NuGet will take what it considers to be the best match.

If your project targets .NET Framework then it will consider the assemblies in the NuGet package that also target the .NET Framework to be the best match. In general the more specific the target framework is the one that wins.

So you are left with either:

  1. Creating a new NuGet package which does not have the .NET 4.5 assemblies.
  2. Not using NuGet and just extracting the files.
  3. Modifying the project afterwards so the assemblies you want to reference are referenced.

Another question here is why do you need to reference the .NET Standard assemblies?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM