-
Notifications
You must be signed in to change notification settings - Fork 707
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
Remove unnecessary NuGet package references. #3449
Conversation
Hey @teo-tsirpanis Thanks for this change. In the meantime would you please rebase as there some added conflicts, because we added support for .NET 5. Finally, can you please create a tracking issue for this and follow the PR template? Thanks! |
Hello @nkolev92, I created an issue, rebased the branch and edited the PR's description. |
@teo-tsirpanis I ran a build, but it's failing restore with package downgrade wanrings that are elevated to errors:
|
@zivkan, the versioning conflicts were caused by an old version of |
Unfortunately we can't update the newtonsoft.json version. There are some upstream dependencies of NuGet that are tied to a specific version. If all the warnings are happening in a test utility, I think it's ok to bump the versions for those projects only. |
OK @nkolev92, I reverted to Newtonsoft.Json 9.0.1. |
@teo-tsirpanis sorry about the delays. We've been in a mad rush try to meet a deadline. The builds are now failing with this error:
|
OK @zivkan, I removed the dependency (it was unnecessary for |
All tests passed except of 16. At least one of them ( |
Sorry, I forgot that the .NET 5 SDK had a bug in preview 5 and 6: 070c016 dotnet/sdk#11862 If you make sure your machine has the .NET 5 preview 4 SDK, or one of the nightly preview 7 or 8 SDKs, I think it should be ok. Your branch didn't change any code, only packages, so as long as the code compiles, we should be good. Although I'm interested in which tests failed because of the different number formats, because it sounds like we have a bug, even if it's just in the tests. If you can revert your change adding the thanks. |
Done. By the way, |
I'm not sure what happened but github is now showing 31 commits and 133 files changed. |
I rebased the branch... 😳 |
It looks like you merged NuGet's dev branch, rather than rebasing. Since your work was in your fork's dev branch, when you merged NuGet's dev branch, NuGet's dev commits got added after your commits in the commit history, which means all their commits hashes got changed, hence why GitHub says they're changed. I think you should be able to fix it with an interactive rebase. Otherwise feel free to close this PR and open a new one (and use a different branch name, just in case). |
Ignore the .idea and .ionide directories.
OK, I cherry-picked each commit into the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks @teo-tsirpanis!
There's one small change I'd like for you to make before I approve this PR.
@@ -21,6 +21,13 @@ | |||
<ProjectReference Include="$(NuGetCoreSrcDirectory)NuGet.Versioning\NuGet.Versioning.csproj" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup Condition="'$(IsCore)' == 'true'"> | |||
<PackageReference Include="System.Collections" Version="4.3.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll surprised this did not fail the build.
The versions should remain managed in packages.targets.
There's a section with packages used in test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also surprised it didn't fail the build, but it didn't. This suggests that removing the versions might leave these PackageReference
s without a version, in which cause the build might fail. So, my thought is we merge as-is, and we should fix our msbuild files as an engineering improvement, and not burden the contributor for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I buy that.
Can we create a follow-up issue first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too late, I used the SystemPackagesVersion
property.
If I recall correctly, these references stayed because they resolve package version conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it again to build without these references and got this (adjusted for brevity):
error NU1605: Detected package downgrade: System.Collections from 4.3.0 to 4.0.11. Reference the package directly fr
om the project to select a different version.
error NU1605: Plugin.Testable -> NuGet.Protocol -> NuGet.Packaging -> Newtonsoft.Json 9.0.1 -> System.Xml.ReaderWri
ter 4.0.11 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.Collections (>= 4.3.0)
error NU1605: Plugin.Testable -> NuGet.Protocol -> NuGet.Packaging -> Newtonsoft.Json 9.0.1 -> System.Collections (
>= 4.0.11)
Same with the other packages. The real fix was to upgrade Newtonsoft.Json
but unfortunately it can't be done at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zivkan, it didn't fail the build because the SystemPackagesVersion
property is equal to 4.3.0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the issue I linked, our MSBuild targets are supposed to validate that no PackageReference
has a Version
attribute set before it then applies all the versions. This isn't working, but is out of scope for your PR. Assuming the current build in progress is green, I'll merge this PR and the NuGet team will be responsible for fixing up our MSBuild files (unless someone in the community wants to do it and send a PR 😊 ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a follow up :)
Hmm, why is the CI failing? 🤨 |
One unit test on Windows failed, it looks like a flaky test. A directory was not empty when it was trying to be deleted (I'm guessing cleanup after a test ran). About 5% of Linux build hang, and this build was one of those. I've started a new build. |
Bug
System.*
packages that do not target .NET Standard 2.0 and/or their version number is stuck at 4.3.0.Fix
Details: This PR removes packages that are not meant for .NET Standard 2.0, significantly trimming the dependency tree, in a similar way to dotnet/msbuild#5242.
Testing/Validation
Tests Added: No
Reason for not adding tests: No functionality changed
Validation: The CI builds still succeed