NuGet Warning NU5048
The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at https://aka.ms/deprecateIconUrl
Issue
Icon URL is deprecated in favor of embedding the icon inside the NuGet package. Possible causes are:
- When creating a package from a nuspec file, it contains a
<iconUrl/>
entry. - When creating a package from a MSBuild project file, it contains a
<PackageIconUrl>
property.
Solution
To stop seeing this warning, add an embedded icon to your package.
For MSBuild project files, add an <PackageIcon/>
property, as follows:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<PackageIcon>icon.png</PackageIcon>
...
</PropertyGroup>
<ItemGroup>
...
<None Include="images\icon.png" Pack="true" PackagePath=""/>
...
</ItemGroup>
</Project>
For nuspec files, add an <icon/>
entry that points to the file that will be the package icon:
<package>
<metadata>
...
<icon>images\icon.png</icon>
...
</metadata>
<files>
...
<file src="..\icon.png" target="images\" />
...
</files>
</package>