-
Notifications
You must be signed in to change notification settings - Fork 255
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
New dependency resolver downloads more packages than before #13943
Comments
Can you please post the exact steps to take in order to invoke the legacy resolver when a user is building his project within Visual Studio? Not when the user is using msbuild. After performing the steps below, it does not invoke the legacy resolver. I verified this by looking inside the project assets file within obj folder. My steps are as follows:
<Project>
<PropertyGroup>
<RestoreUseLegacyDependencyResolver>true</RestoreUseLegacyDependencyResolver>
</PropertyGroup>
</Project>
Note: Whenever I used CMD and msbuild to build my solution
The legacy resolver WAS invoked. I looked inside my obj\projectassets file, and it correctly showed |
Where is |
It was not in the correct directory. I moved it to the root, and now it works. Thanks! |
The new resolver has a significant variation from previous behavior. My company does not allow us to restore packages directly from nuget.org. Instead, our connections are proxied thru artifactory. Artifactories Xray product blocks download of any packages that it finds vulnerabilities with. Whenever a vulnerability is found in a package we are using such as System.Text.Json, we rely on being able to list the package in Directory.Build.props, specifying a higher, non-vulnerable version. Previously, this ensured that even transitive dependencies on vulnerable packages would be overridden. Only the version specified in Directory.Build.props would be downloaded. The new resolver tries to retrieve the older, vulnerable versions. Artifactory blocks them, causing dotnet restore to fail. Im facing some critical deadlines at the moment and so my resolution was to roll back to visual studio 17.11 / .Net 8 Desired behavior. When a package is specified in Directory.Build.props, the resolver should only retrieve that version, ignoring all other direct and transitive references to that package. |
NuGet Product(s) Affected
NuGet.exe, Visual Studio Package Management UI, MSBuild.exe, dotnet.exe
Current Behavior
As an optimization, the new dependency resolver downloads packages in parallel. However, when processing the direct package references, the dependencies are also downloaded when they weren't before.
For example:
The new resolver queues up a task to download
A 1.0
andB 2.0
. Then it processesA 1.0
and queues up a download ofB 1.0
. Then it processesB 2.0
which ends up being the resolved version. However, sinceB 2.0
was directly referenced, NuGet does not need to technically downloadB 1.0
.Desired Behavior
We should process all of the direct dependencies first and then use background tasks to download children after that, ensuring that extra packages are not downloaded.
Additional Context
Some users are hitting issues since their feeds don't offer up the packages. So even though the resolved graph is identical, they experience restore failures.
Workaround
Users can workaround the issue by setting an MSBuild property in their
Directory.Build.props
or an environment variable:Related Issues
#13930
https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2301598
The text was updated successfully, but these errors were encountered: