To ensure the creation of well-formed NuGet packages
and for maximum compatibility with external tools, explicitly define the
<PackageIconUrl>
node or disable package generation by defining the
<IsPackable>
node with value false
.
While in principle only defining <PackageIcon>
should be enough, not all
external tools are capable of correctly handling this modern type of package
icon definition. Similarly, while <PackageIconUrl>
is deprecated, some older
tools can not correctly handle the modern option. For maximum compatibility it
is therefore recommended to define both.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackageIconUrl>https://raw.githubusercontent.com/Corniel/dotnet-project-file-analyzers/main/design/logo_128x128.png</PackageIconUrl>
</PropertyGroup>
</Project>
Or disable packability:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>