dotnet --info
.NET Command Line Tools (1.0.0-preview4-004094)
Product Information:
Version: 1.0.0-preview4-004094
Commit SHA-1 hash: fc4eb2108c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Repro steps:
If you open up the generated nuspec file you will see the correct version numbers for both TestApp and the dependent TestLibrary project.
Note the following bugs:
Related to
https://github.com/dotnet/cli/issues/4725
Quick feedback here will be appreciated. If we need to do something in migration we need to know :)
rc2 has this fixed (the part about all proj refs end up as 1.0.0). we need to integrate into CLI this week.
@joelverhagen - anything else here we need to deal with?
@jgoshi @piotrpMSFT 1) & 2) seem to have been fixed in latest versions of pack and sdk. Would appreciate if you could verify it.
as for 3) and 4) seem to be expected behavior, still discussing if we need to fix them.
@jgoshi 4) is definitely the right behavior going forward. There is no change in behavior functionally, and this way we are consistent with nuget.exe pack
seem to have been fixed in latest versions of pack and sdk.
Which versions? I can verify this is still happening in CLI 1.0.0-preview4-004233 (RC.2)
@natemcmaster latest build from dev branch of nuget. if you are interested in trying it out , i can help you patch the DLLs correctly to give it a try.
first issue and second issue in OP are fixed, awaiting next integration into CLI.
third issue is a complicated one...let's talk with joel and find the other issue tracking that.
fourth issue is by design - dotnet pack in preview2 started writing out version ranges, which we consider a bug that we've fixed.
RC.3 fixes part of the problem (all version used to be set to 1.0.0), but has introduced others, primarily, that the 'version' of package references is resolved _at restore_, not _at pack_. This means --version-suffix can only apply to the currently-packed project, not its references.
Repro:
Create two projects:
Project.Abstractions
Project.Console --> depends on Project.Abstractions
Goal:
Pack Project.Console with a pre-release label that includes a build number
Comparison:
In project.json, if I do dotnet pack --version-suffix build20170113, project references with '-*' versions, version of the package I'm packing and the project it references both receive build20170113 as the version suffix.

With 4.0.0-rc3, if I have the same setup, running the same pack command (dotnet pack --version-suffix build20170113, the ProjectReference loses the version suffix value.

AFAIK --version-suffix wasn't meant to replace '-' in Package References, it was only meant to replace the '-' in the version of the package being packed.
CC: @rrelyea @emgarten thoughts?
If so, it's a significant breaking change from project.json behavior and will make builds difficult for anyone with multiproject solutions.
@natemcmaster why cant you just use package reference version= 3.0.0-$(VersionSuffix) instead of putting a "*" ?
@rohit21agrawal a little confused by your question. PackageReference and ProjectReference are not the same thing. Can you clarify what you were asking?
@natemcmaster oh i thought you were referring to the behavior of PackageReference, i misread your OP.
can you attach your project's assets file here?
Here's a gist with the repo:
https://gist.github.com/natemcmaster/2eb494cf07771f70825ba72a3e15c444
Here is the project.assets.json file:
project.assets.json.txt
One possible workaround: if you set version suffix during restore, it get's baked into the project.assets.json file, and shows up in nuspec:
dotnet restore /p:VersionSuffix=build20170113
dotnet pack --version-suffix build20170113
This is still less than ideal, and I suspect will go wrong when the build runs NuGet restore within Visual Studio.
feel free to file a separate bug on this, but i feel this workaround is the only solution going forward.
@natemcmaster any other bugs from the OP that still repro for you?
Without the workaround of calling restore AND pack in one MSBuild invocation https://github.com/NuGet/Home/issues/3953#issuecomment-272586454, item 3 in OP description still repros. It's the version-suffix on project reference issue we've been discussing.
@natemcmaster could you open another bug which specifically tracks that issue, and close this one please?