"Target Project CSPROJ File"

<!-- This ItemGroup should be added inside the Project node -->
  <ItemGroup>
    <ProjectReference Include="..\SourceGen\SourceGen.csproj"
                      OutputItemType="Analyzer"
                      ReferenceOutputAssembly="false" />
  </ItemGroup>


Code snippet taken from "Two Decades of C#: A Reference - C# 9".