Skip to content
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

Wrong dependency versions in the NuGet package after 'dotnet pack' if the project hasn't been rebuilt before #4867

Closed
livarcocc opened this issue Mar 21, 2017 · 4 comments
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue

Comments

@livarcocc
Copy link

From @DmitrySikorsky on March 15, 2017 22:56

Steps to reproduce

  1. You are using VS2017 and .csproj files.

  2. Let's say you have ProjectA version 1.1.1 that has dependency (project dependency with no version specified) to the ProjectB version 1.1.1. You rebuild them and everything is fine.

  3. After that you remove 'bin' and 'obj' folders, open the .csproj files and change (manually, in a text editor) VersionPrefix to 1.1.2. Then run 'dotnet pack'. If you open the resulting ProjectA.1.1.2.nupkg file as the archive and look at .nuspec file you will see, that ProjectB dependency version is 1.1.1, not 1.1.2!

  4. If you remove 'bin' and 'obj' folders again, open solution in the VS2017 and rebuild, then run 'dotnet pack' and open .nuspec file again, you will see that the dependency version is changed to 1.1.2.

Is it by design? I have created .bat files to pack and then push to nuget and I have never had this behavior before (when used project.json files). So it seems to be not obvious.

I have found this when pushed the packages to the NuGet and then got 'The located assembly's manifest definition does not match the assembly reference' exception when tried to use them. As I have found, both 1.1.1 and 1.1.2 versions are downloaded (1.1.2 are downloaded as primary dependency and 1.1.1 as secondary ones).

Thank you!

Copied from original issue: dotnet/cli#6049

@livarcocc
Copy link
Author

Have you run dotnet restore again after changing the versions?

Dotnet pack uses information based on your project.assets.json file that gets updated only when you run dotnet restore.

In any case, @rohit21agrawal @mishra14 can you guys take a look?

@livarcocc
Copy link
Author

From @DmitrySikorsky on March 15, 2017 23:19

No, I didn't. But I didn't run it before too, when used project.json. And it worked as expected.

@DmitrySikorsky
Copy link

@livarcocc thank you!

@rohit21agrawal
Copy link
Contributor

@livarcocc @DmitrySikorsky we are already tracking this via : #4337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants