-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packing project with project dependencies does not include build number in nupkg #7883
Comments
Not only with version suffix, also with non-prerelease versions.
The result nupkg is v1.0.1 but dependencies via project referenced is always 1.0.0. It seems now cli only read the Version property from referenced .csproj file but do not honor the multiple project/package relationship, unlike the old project.json tooling. |
I've seen the same, but by setting the environment variables VERSION_PREFIX and VERSION_SUFFIX everything appears to be ok. I think it is in the restore stage that this is needed. If you look in project.assets.json inside the obj directory, you can see the version it is using. That appears to be copied across to the nuspec file on packing. After I set the correct VERSION_PREFIX and VERSION_SUFFIX environment variables, the project.assets.json file has the correct versions, so does the nuspec files. |
@nrandell you're right. When I specify the build number when restoring (e.g. I've updated the first post with above workaround. |
This is a duplicate of NuGet/Home#4337. This workaround is also mentioned in that issue. |
I see, thanks. 👍 |
Steps to reproduce
ProjA
andProjB
)ProjB
toProjA
:dotnet pack
on the solution specifying a build number:Expected behavior
A nupkg for
ProjB
with a dependency toProjA
with version1.2.0-preview1-123
.Actual behavior
A nupkg for
ProjB
with a dependency toProjA
with version1.2.0-preview1
.Environment data
dotnet --info
output:This behavior changed with the move from project.json to MSBuild. @natemcmaster also mentions this in one of his blog posts about the conversion: http://www.natemcmaster.com/blog/2017/01/19/project-json-to-csproj/ (at the "dependency type" chapter). Neither
--version-suffix
or/property:BuildNumber
works as expected.This change causes other libraries which in turn reference
ProjB
to select the lowest (e.g. first) version ofProjA
.Workaround
Not sure if this is a workaround, but when I specify the build number when restoring packages it writes the correct reference in the
project.assets.json
:When packing the correct version number for dependencies will be used now.
The same behavior is achieved when settings the
BuildNumber
environment variable.The text was updated successfully, but these errors were encountered: