Proj0401: Only publish executables
Executing dotnet publish publishes the application and its dependencies to a
folder for deployment to a hosting system. Executing dotnet publish on a
project with an output type other than exe or winexe has no effect. As a
result, this rule advises to set <IsPublishable> to false.
More info
can be found here.
Non-compliant
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsPublishable>true</IsPublishable>
<OutputType>Library</OutputType>
</PropertyGroup>
</Project>
Compliant
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsPublishable>false</IsPublishable>
<OutputType>Library</OutputType>
</PropertyGroup>
</Project>