Targeting multiple framework versions

Oct 30, 2014 at 12:16 PM
Is it possible to use this package to target multiple framework versions?

All the guides I have seen state the same - have different targets for each version.

This results in multiple builds which are then manually put into a single package.

However, NuGet for MSBuild generates the package per build so this method will result in multiple packages.
Coordinator
Nov 4, 2014 at 12:38 AM
Edited Nov 4, 2014 at 12:38 AM
Correct. The expectation for this project is just to have a single output nupkg, for a single framework version.

For example, take the layout for a fictitious MyPackage.1.0.0.0.nupkg:
  .\libs\
            net20\
                 MyProject.dll
            net40\
                 MyProject.dll
            net45\
                 MyProject.dll
That would allow your package to change which reference gets used depending on the framework version that the project consuming your package is using.

As for this particular project, it was only ever expected to be used in simple scenarios of creating a single package for a single DLL for a single framework version. If you're trying to generate multiple framework versions out of the same project, or using multiple projects targetting the different versions with the source files shared between them, you're likely to have some sort of customized build process in there.

The MSBuild tasks this project uses could very well be used to hook it somehow, but I'd imagine you want a canned solution, and don't want to have to do anything to set it up. I believe there are Visual Studio project extensions out there that'll give you a bit more control over the process.