1
votes

Background: I maintain several "framework" DLLs used by various apps and web services in my organization, and I deploy them as a NuGet package. Some of the consumers are at .NET 4, others are at .NET 3.5 so most of these framework DLLs are .NET 3.5 for maximum compatibility. However, there are some that require .NET 4.0, so I only include them in the lib/net40 folder of my NuGet package.

I recently added some code related to Entity Framework to one of the .NET 4 libraries, so in theory I should add a NuGet dependency to the Entity Framework package. However, the Entity Framework NuGet package is only available for .NET 4.0, so I suspect if I do this then I'm breaking my .NET 3.5 consumers. What should I do here?

2

2 Answers

2
votes

There isn't a way to do this today without making multiple packages. We (the NuGet team) plan to add target framework-specific dependencies in 1.8, which would allow you to specify EF be installed as a dependency only when the target framework is .NET 4.

0
votes

As far as I know, your only real choice is to break it into two packages, one for EF and one without.

I would suggest adding version aware dependencies as a suggestion over at http://nuget.codeplex.com/