Roly
Roly

Reputation: 1536

Specifying targetVersion on NuGet package install

All the projects in my solution are targeting .NET 4.6.1. When I add NUnit via NuGet, it then adds the entry to the packages.config with targetVersion=461. However, due to a dependency that depends on 4.0, I need to reinstall NUnit with a targetVersion=40. I've been looking through NuGet options but haven't found anything for this. Does anyone know if this is possible?

Thanks

Upvotes: 0

Views: 101

Answers (1)

Matt Ward
Matt Ward

Reputation: 47917

NuGet does not work that way. It looks at the framework your project is targeting and then installs the assembly that best matches that framework.

If you want to use the .NET 4.0 assembly for NUnit then you will need to either:

  1. Change the reference manually after using NuGet.
  2. Change your project to target .NET 4.0
  3. Not use NuGet. Download the NUnit assemblies and directly reference the assembly you need.

Upvotes: 1

Related Questions