.NET project file analyzers community

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-compliant

<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>