msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

[Built-in analyzer] Reference item points to the output of a project

Open ladipro opened this issue 3 months ago • 3 comments

Background

This issue tracks one of the BuildCheck analyzers we would like to ship in-box with MSBuild.

Goal

Implement an analyzer with the following rule: Reference items are not allowed to reference outputs of projects that are part of the build.

Notes

When one project depends on another, the ProjectReference item should be used to codify the relationship. It is generally incorrect to use a Reference for this purpose.

ladipro avatar Mar 18 '24 13:03 ladipro

There are several advanced uses like "include the ProjectReference for build ordering but then do {some more complicated thing to reconstruct the path} and Reference that for use in compilation". We should decide whether those will be flagged or allowed under v1 of this analyzer. I'm pretty ok either way but we should write down the thought process.

rainersigwald avatar Mar 18 '24 14:03 rainersigwald

What's the plan for locally suppressing warnings from these analyzers?

KalleOlaviNiemitalo avatar Mar 18 '24 15:03 KalleOlaviNiemitalo

Analyzers will be enabled/disabled/configured with .editorconfig. Local suppression via "pragmas" directly in project files is currently not planned for the first version.

ladipro avatar Mar 18 '24 16:03 ladipro