Nuget packages suddenly disappeared in my .net maui project

511 Views Asked by At

I am using Visual Studio Community 2022. I have three .net maui projects in this solution, all of which were working as expected with the require nuget packages showing up in "Manage Nuget Packages.." Suddenly, I started to get errors that assemblies were missing (CommunityToolkit.Maui, CommunityToolit.Mvvm, etc.). Upon checking "Manage Nuget Packages", they were all gone.

  • I have verified that in the project.csproj all of the PackageReferences are there.
  • I have verified the proper environment variables.
  • The other projects still work.
  • I have this project on a separate, older computer and it works. I have compared every aspect of the two that I could think of and cannot find a cause for this behaviour.
  • I cannot install the needed nuget packages to this project.
  • I cannot restore nuget packages in the PM console.

I have restarted the computer. I have repaired Visual Studio. I have deleted the obj/bin folders. I expected to have the nuget packages available to my project and for my project work work as it was previously.

1

There are 1 best solutions below

0
JMS On

After 2 days and numerous searches online, I found a reference to the TargetFrameworks tag in the csproj file.

Looking more closely I discovered that "net7.0-windows10.0.22621.0" had changed to "net7.0-windows10.0.22000.0" (as compared to my notebooks file).

When I changed it to "net7.0-windows10.0.22621.0", everything re-appeared, and the project worked as expected.