在 CSPROJ 中显示为:
<PackageReference Update="Microsoft.Maui.Essentials" Version="8.0.6" />
它还在 Packages 下显示此版本。但是,在我构建之后,Packages 将其显示为 8.0.3,并且出现错误:
Error NU1605 Warning As Error: Detected package downgrade: Microsoft.Maui.Essentials from 8.0.6 to 8.0.3. Reference the package directly from the project to select a different version.
AndroidAppCore -> Microsoft.Maui.Controls 8.0.6 -> Microsoft.Maui.Controls.Core 8.0.6 -> Microsoft.Maui.Core 8.0.6 -> Microsoft.Maui.Essentials (>= 8.0.6)
当我进入 Nuget 包管理器并再次升级时,一切都很好,直到我执行清理和构建。然后它重复整个循环。
我的 csproj 文件中也有这个:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android</TargetFrameworks>
<SupportedOSPLatformVersion>23</SupportedOSPLatformVersion>
<UseMaui>True</UseMaui>
<UseMauiEssentials>true</UseMauiEssentials>
我在这里阅读了这篇文章,但似乎没有帮助:https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605
我需要做什么?
我进入 .csproj 并注意到它显示为 Upgrade= 而不是 Include=。我将其更改为包的 Include= 并且不再发生错误。