Visual Studios 22 Nuget Package Manager: I get a System.IO.DirectoryNoFoundException Error when installing Microsoft.Extensions.DependencyInjection

Nieman, Michelle J 20 Reputation points
2024-03-05T15:24:56.6233333+00:00

System.IO.DirectoryNotFoundException: Could not find a part of the path \packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\buildTransitive/net461/Microsoft.Extensions.DependencyInjection.Abstractions.targets

Shouldn't the installer take care of creating the targets of the dependencies for the package?

User's image

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,031 questions
{count} votes

Accepted answer
  1. Michael Taylor 53,416 Reputation points
    2024-03-05T19:31:14.7566667+00:00

    Yes it will. That isn't the issue here I believe. One thought that comes to mind is that your project is in a long directory and adding all this extra pathing is causing it to exceed the max path size.

    Another thought is that there was an issue with downloading the package. Since you are targeting NET 4.6 it looks like then check your packages folder to confirm it was downloaded. If not then restore the packages again.

    Yet another thought is that your upgrading and there is a conflict between the old and new packages. Close VS, wipe the packages folder and open VS back up and restore the packages again. Then try upgrading.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.