An MSBuild project file linter to validate project file as part of build process.
The ProjectLinter consists of a set of validators which run against the MSBuild project to check for known issues.
These include:
- Rooted paths
- Unnecessary|incorrect properties
- Required dependencies
These validators are automatically wired into the build process using the package .targets file and run before the 'CoreBuild' target.
Warnings and errors are written to the standard build output and any validation failures will fail the build.
To add linting to your project simply add a PacakgeReference. The easiest way to do this for a large number of projects is to include a Directory.Build.targets file at the root of the repo containing:
<Project>
<ItemGroup>
<PackageReference Include="ProjectLinter" Version="0.2.9" PrivateAssets="All" />
</ItemGroup>
</Project>
To automatically import the nuget pacakge into all projects.
To skip particular validators for a project add their Ids (separated by ;) to the ProjectLinterSuppressions
property
<Project>
<PropertyGroup>
<ProjectLinterSuppressions>NoOldStyleProjects</ProjectLinterSuppressions>
</PropertyGroup>
</Project>