I'm building a class library and I will deploy it a NuGet package, which lets me choose different assemblies to be added as references based on the .NET framework version of the project it's added to. This is a very nice feature, but what I'm wondering is whether it is possible to have a single class library project, and build it against mulitple versions of the .NET framework?
I'd rather avoid having:
MyLibrary40.dll
and MyLibrary45.dll
if possible, because the two projects would have to share a lot of code. The 4.5 version will be offering async
functions, which is a 4.5 feature.
Does anyone know what the best approach for this is? Can I use multiple build configurations? Or must I go down the separate project route?
If I was working in C++ I'd probably use multiple configurations and #if
blocks around the functions that are only supported in one configuration, but I worry this would lead to me having two assemblies with the same name that do different things.
Thanks in advance!