Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 1.48 KB

File metadata and controls

62 lines (49 loc) · 1.48 KB
title NuGet Error NU5046
description NU5046 Error code
author JonDouglas
ms.author jodou
ms.date 9/4/2019
ms.topic reference
ms.reviewer karann
f1_keywords
NU5046

NuGet Error NU5046

The icon file 'icon.png' does not exist in the package.

Issue

NuGet is unable find the icon file in the package.

Solution

  • Make sure that the file that is marked as the package icon exists at the source and it is readable, and the target matches the path expected by the icon property.
  • Ensure that the file is referenced in the nuspec or in the project file.
    • When creating a package from a MSBuild project file, make sure to reference the icon file in the project, as follows:

      <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
            ...
            <PackageIcon>icon.png</PackageIcon>
            ...
        </PropertyGroup>
      
        <ItemGroup>
            ...
            <None Include="images\icon.png" Pack="true" PackagePath=""/>
            ...
        </ItemGroup>
      </Project>
    • When you are creating a package from a nuspec file, make sure to include the icon file in the <files/> section:

      <package>
        <metadata>
          ...
          <icon>images\icon.png</icon>
          ...
        </metadata>
        <files>
          ...
          <file src="..\icon.png" target="images\" />
          ...
        </files>
      </package>

Learn more about packaging an icon image file.