-
Notifications
You must be signed in to change notification settings - Fork 253
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
Dependencies via project reference are not having versions updated when performing a dotnet pack #4779
Comments
@rohit21agrawal is pack reading the dependency version from the assets file or from the project directly? |
From the assets file |
@KallDrexx I'm not able to repro this, can you provide further steps? The nuspec I get is: <?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>test2</id>
<version>1.0.0</version>
<authors>test2</authors>
<owners>test2</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETStandard1.4">
<dependency id="test1" version="1.0.2" exclude="Build,Analyzers" />
<dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package> Is it possible you missed the Also, if you are still seeing the issue please provide the project.assets.json files from test1 and test2 |
I will test again in a bit but looking back at your comment and the steps I think I wrote step 17 down wrong and it was probably only a |
yes I was correct, I did not run dotnet restore in step 17. The following shell script reproduces the issue for me:
The thing is, this workflow is natural to me. If you assume that this is a single solution with multiple projects (one being a common library and the other being an SDK/implementation library) when a code change facilitates changing something in both libraries I naturally increment the version in both projects after testing the change out. I then go into each folder and It doesn't make sense to me that I would have to dotnet restore test2 just because I changed the version number of test1, especially since it requires any developer to remember that they did indeed change the version of the referenced project. Edit: |
With csproj there is no longer a version range associated with the reference since projects are referenced separately, you get the project you referenced and the version of it is discovered at restore time when all dependencies are walked. This is also the reason why a restore is needed, all dependency resolution, including discovering dependency projects happens at this time. |
Sure logically that makes sense. Pragmatically it is extremely error prone. What if |
I agree with @KallDrexx, it makes no sense to have to run Since all references are ProjectReferences they should respect the Version that is defined in .csproj, just like ProjectReferences can immediatelly "respect" code changes in referenced projects. |
Duplicate of #4790 |
From @KallDrexx at https:/dotnet/cli/issues/5984
Steps to reproduce
mkdir test1
mkdir test2
cd test1
dotnet new classlib
<VersionPrefix>1.0.1</VersionPrefix>
dotnet restore
thendotnet pack
cd ../test2
dotnet new classlib
vim Class1.cs
public class Class1 : test1.Class1
<VersionPrefix>1.0.0</VersionPrefix>
dotnet restore
thendotnet pack
1.0.2
, then build and repack ittest2
folder and update the version to1.0.1
dotnet restore
thendotnet pack
.nuspec
fileExpected behavior
Dependency should be listed as:
<dependency id="test1" version="1.0.2" exclude="Build,Analyzers" />
so that any nuget package built against thetest2
library auto-restore test1 to1.0.2
Actual behavior
Dependency is outdated and listed as
<dependency id="test1" version="1.0.1" exclude="Build,Analyzers" />
This is impacting us heavily right now as any time we build a nuget package it has outdated dependencies, which when restored on other projects causes
FileLoadExceptions
due todotnet restore
restoring an older dll.Environment data
dotnet --info
output:The text was updated successfully, but these errors were encountered: