dotnet-project-file-analyzers

Proj0006: Add additional files to improve static code analysis

The .NET project file analyzers need access to files that are not available via the analyzer context. By adding additional non-compiling files, those files become available in the analyzer context too.

See: https://github.com/dotnet/roslyn/blob/main/docs/analyzers/Using%20Additional%20Files.md

Compliant

For project files, it is advised to add the additional file with Visible="false" as seeing it twice in the IDE is adding confusion.

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

  <ItemGroup>
    <AdditionalFiles Include="*.csproj" Visible="false" />
  </ItemGroup>

</Project>

For properties, it is advised to add the additional file with a link to the special properties folder, to simplify the access to the files.

<?xml version="1.0" encoding="utf-8"?>
<Project>

  <ItemGroup>
    <AdditionalFiles Include="../props/common.props" Link="Properties/common.props" />
  </ItemGroup>
  
</Project>