Force nuget to use .net framework 4.0 assembly instead of 4.5

Topics: General
Jul 11, 2014 at 11:46 AM
Cross posted from here:

have a project mixing .NET 4.5 and 4.0 projects.

Every time When I update Newtonsoft.JSON or add a new package, the 4.5 projects will reference different builds than the .NET 4.0 projects:
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net40" />
and the .net 4.5 projects reference the 4.5 build:
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" />
The 4.5 projects however reference the 4.0 projects, causing the build to fail on TFS build (because it builds all in 1 folder) and when the Newtonsoft.Json .NET 4.5 build ends up in the build folder before the .NET 4.0 projects build, causes the projects targeting .NET 4.0 to fail.

Is there a way to force update-package to pick targetFramework="net40" for all projects in the solution (even if the project targets .NET 4.5) (without having to find-and-replace in files after each update)?

So similar to what you can do with the install-package -version?
Oct 8, 2014 at 10:16 PM
Same issue here. A -TargetFramework option would be very useful.