c# – NuGet Errors in Visual Studio 2022 After Changing Project Icon and Reinstalling .NET and Visual Studio


I am encountering a persistent issue with NuGet package resolution in Visual Studio 2022 (Version 17.11.4) that started after I changed the project icon in my .NET MAUI solution. Now I am getting multiple errors like the following:

Unable to resolve 'Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)' for 'net8.0-windows10.0.19041'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org.

What I have tried so far:

  1. Resetting to Last Working Commit:

    • I reset the project to the last commit where everything was working, but the issue persists.
  2. Reinstalling Visual Studio and .NET SDKs:

    • I completely uninstalled and reinstalled both Visual Studio and the .NET SDK.
  3. Clearing NuGet Cache and Reinstalling Packages:

    • I cleared the NuGet cache using nuget locals all -clear.
    • Reinstalled all NuGet packages with the -Reinstall option.
  4. Creating a New Solution:

    • I tried creating a new solution from scratch, but the same errors occur.
  5. Verifying Product Versions:

    • I have verified that all the installed products (SDKs, runtimes, etc.) are up-to-date.

My Environment:

  • Visual Studio Version: 17.11.4
  • .NET SDK Version: 8.0.100
  • Operating System: Windows 10

I am attaching screenshots showing all the errors and the versions of the installed components.

Error Details:

  • NU1100 errors appear for various packages, including Microsoft.IO.RecyclableMemoryStream, Microsoft.Maui.Controls, etc.
  • It seems like PackageSourceMapping is not correctly considering the configured sources, even though nuget.org and the default Visual Studio package sources are enabled.

Request:

I am looking for suggestions on how to resolve this issue. It seems to be related to NuGet and package source mapping, but none of the usual fixes (cache clearing, reinstalling, etc.) have worked. Any insights or troubleshooting steps would be greatly appreciated.

Thank you in advance!

Screenshots:

enter image description here

Microsoft Visual Studio Community 2022
Version 17.11.4
VisualStudio.17.Release/17.11.4+35312.102
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

ASP.NET and Web Tools   17.11.231.19466
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.11.231.19466
Azure App Service Tools v3.0.0

C# Tools   4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Extensibility Message Bus   1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitHub Copilot   0.2.1653.9816
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.11.3 (ba13144)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.11.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.11.3.2442001+68650a7d94261bc56a1f4bc522c2ee35314b1abb
Provides languages services for ASP.NET Core Razor.

TypeScript Tools   17.0.30715.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.11.0-beta.24421.7+af2f522de602281d4ef5a7b71507c428e814c5c1
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.11.0.98 (d17-11@86652fe)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.11.3.11 (remotes/origin/d17-11@cdbb0a4fdd)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK   13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: d9a6e87
    Java.Interop: xamarin/java.interop/d17-5@149d70fe
    SQLite: xamarin/sqlite/3.40.1@68c69d8
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Leave a Reply

Your email address will not be published. Required fields are marked *