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" />

Note

メタデータの IncludeAssets, PrivateAssets などは、PackageReference アイテム上に維持する必要があることに注意してください。