豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.2 KB

File metadata and controls

45 lines (33 loc) · 1.2 KB
title NuGet Error NU1008
description NU1008 error code
author nkolev92
ms.author nikolev
ms.date 11/07/2022
ms.topic reference
f1_keywords
NU1008

NuGet Error NU1008

Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: PackageId.

Issue

When using central package management, versions must be defined on the PackageVersion item.

In your project file, you may see:

<!-- In the project file. -->
<PackageReference Include="PackageId" Version="5.1.0" />

Solution

  • Remove the version from the PackageId PackageReference.
  • You may need to add or update the PackageVersion item for PackageId in Directory.Packages.props

Example:

<!-- In the project file. -->
<PackageReference Include="PackageId" />
<!-- In the Directory.Packages.props -->
<PackageVersion Include="PackageId" Version="5.1.0" />

Note

Note that metadata such as IncludeAssets, PrivateAssets etc. should remain on the PackageReference item.