I have a C# class library targeting .NET 4.7.2 for which I use VSTS to build and deploy to a private NuGet package feed whenever I push a commit. This all works fine.
I also have a legacy project targeting .NET 4.0 in which I would like to make use of the above library. I have created a new branch of my library and ported it to target .NET 4.0 (had to remove some unsupported functionality) and have created a new VSTS CI build that is triggered by pushes on this branch. Again, all working fine.
The issue is that the resulting NuGet package just shows up as a new version of the .NET 4.7.2 one! Ideally I would like to have 2 packages show up in my private feed: MyPackage
and MyPackage.dotnet40
Is this even possible? Or should I be doing something completely different?
Solved
Thanks to @DanielMann's answer below I solved this problem by adding a .nuspec
file to my project and re-configuring (slightly) my NuGet pack task in my VSTS build definition:
- navigate to project root (not solution) in command prompt
- run
nuget spec
to create a.nuspec
file alongside your.csproj
file (might need to addnuget.exe
to your PATH) - fill out the
.nuspec
file. I replaced all the placeholders except$version$
which VSTS automatically replaces, but you can provide values for all the placeholders in the Nuget pack task under Advanced>Additional build properties. The important one is the$id$
placeholder, change this to whatever you want your package to be called - add the
.nuspec
to source control and commit/push - update the NuGet pack task so that it points to your new
.nuspec
file rather than your.csproj
file