NuGet 错误 NU1008
Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: PackageId.
问题
使用中央包管理时,必须在 PackageVersion 项中定义版本。
在项目文件中,你可能会看到:
<!-- In the project file. -->
<PackageReference Include="PackageId" Version="5.1.0" />
解决方案
- 从 PackageId PackageReference 中删除版本。
- 可能需在 Directory.Packages.props 中添加或更新 PackageId 的 PackageVersion 项
示例:
<!-- In the project file. -->
<PackageReference Include="PackageId" />
<!-- In the Directory.Packages.props -->
<PackageVersion Include="PackageId" Version="5.1.0" />
注意
请注意,IncludeAssets、PrivateAssets 等元数据应保留在 PackageReference 项中。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈