Software Architect / Microsoft MVP (AI) and Technical Author

C#, Developer Life

Visual Studio 2022, NuGet, and Missing Packages

I rarely have issues with NuGet.  After adding references, it just works.

Recently though I had a frustrating issue with “missing / restored” packages not being included in the build.

Problem

After several code merges from the team, Visual Studio 2022 kept reporting this error:

The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see: http://go.microsoft.com/fwlink/?LinkID=317568. {solution} {path} {project_name}.csproj      3824

 

I made sure these settings were enabled via Tools -> Options:

I checked VS references.  No missing references:

 

I also rebuilt and cleaned the solution and individual projects each time.  No luck.

Solution

In the end, the Package Manager Console resolved the issue.

Specifically, this command:

Update-Package -reinstall

A bit strange.  I expected the Package Restore settings in Visual Studio to automatically handled restoration of any missing NuGet packages (earlier screenshot).

Learn more about this command here.

JOIN MY EXCLUSIVE EMAIL LIST
Get the latest content and code from the blog posts!
I respect your privacy. No spam. Ever.

3 Comments

  1. Chip

    hmmm – getting this error using the command above:
    The `-Reinstall` parameter does not apply to PackageReference based projects

  2. OHNO

    Windows and Visual Studo are a nightmare now.

Leave a Reply