I've been doing updates to .NET Framework targeted versions of projects updating to latest .NET (4.6.2).
Some of these projects are NuGet packages, built in TeamCity 9.0.2.
I've use the steps in this guide to create multiple build configurations for different .NET Framework version as some of the projects I haven't updated to 4.6.2 reference the NuGet packages. So I am trying to get TeamCity to use these build configurations to output the various Net40, Net45, Net46 and Net462 versions so that I have full compatibility without forcing the need to upgrade all projects that use the NuGet when updating the packages.
I really can't figure out how to do this in TeamCity. I am fairly sure that this should be done in the "Build Steps" configuration, but so far I've not managed to get this to work.
So one thing I've tried, which I think I need to do but am not sure is duplicate the first build step and set the Configuration
to Release-Net46
. I think this is necessary otherwise this version of the assembly wouldn't be built (please correct me if I'm wrong about that!)
The second thing I've tried is to duplicate the NuGet Pack
step and in Properties
set Configuration=Release-Net46
but all that did was replace the Net462 version with Net46 and not include both in the artifacts like I'd hoped.
I also tried in the Properties
of NuGet Pack
to have multiple Configuration
elements like Configuration=Release;Configuration=Release-Net46
or Configuration=Release,Release-Net46
but both of those resulted in the build failing altogether so clearly that's not the answer.
I think there must be a way to get this NuGet Pack
build step to pick up the output from the other build configurations and output all available versions of the assembly to the artifacts.
Is that possible? I had thought about creating separate projects for each build configuration in TeamCity but I'm unsure if that's the correct way or it that would cause issues with the package feed and it would seem untidy to duplicate the project four times for each .NET Framework version.