我在 Visual Studio 2022(版本 17.11.4)中遇到 NuGet 包解析的持续问题,该问题是在我更改 .NET MAUI 解决方案中的项目图标后开始出现的。现在我收到多个错误,如下所示:
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.
重置为上次工作提交:
重新安装 Visual Studio 和 .NET SDK:
清除NuGet缓存并重新安装软件包:
nuget locals all -clear
清除了 NuGet 缓存。-Reinstall
选项重新安装所有 NuGet 包。创建新解决方案:
验证产品版本:
我附上显示所有错误和已安装组件版本的屏幕截图。
NU1100
各种包出现错误,包括Microsoft.IO.RecyclableMemoryStream
、Microsoft.Maui.Controls
等PackageSourceMapping
没有正确考虑配置的源,即使 nuget.org
和默认的 Visual Studio 包源已启用。我正在寻找有关如何解决此问题的建议。它似乎与 NuGet 和包源映射有关,但通常的修复(清除缓存、重新安装等)都不起作用。任何见解或故障排除步骤将不胜感激。
提前谢谢您!
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
编辑:我能够通过删除“Nuget-packages”下选项菜单中的 Sourcemapping-Field 中的所有条目来解决该问题!