dotnet-project-file-analyzers

Proj0400: Define the project publishability explicitly

To prevent confusion, explicitly define the <IsPublishable> node. Setting the IsPublishable to true indicates that the package should be published when the dotnet publish command is executed (more info). Projects that have IsPublishable set to false will not be published when the dotnet publish command is executed. Note that dependencies of publishable projects will be included in the results of dotnet publish when executed for the publishable projects, even if they have IsPublishable set to false.

Non-complaint

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

</Project>

Compliant

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <IsPublishable>true</IsPublishable>
  </PropertyGroup>

</Project>