Skip to content

[Built-in analyzer] Flag shared evaluations between restore and build targets #9553

@ViktorHofer

Description

@ViktorHofer

See https://github.com/dotnet/runtime/blob/6d0a902c9585d98bfa44f514bac21a47eabe02fa/eng/testing/workloads-testing.targets#L195-L200 as an example.

Because the Restore and Pack target pass the same set of properties in, the underlying project evaluation evaluation is shared. This resulted in msbuild files restored via a PackageReference not being imported during the build.

I have been fixing so many of these code pieces in my career at Microsoft and it would really be helpful if msbuild could somehow indicate that a shared evaluation between Restore and Build or Pack is most certainly wrong. Sure, there are cases where a shared evaluation might be intentional, but that should < 1%.

Related: #2811

cc @akoeplinger @ericstj

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: BuildCheckBuildCheck SuggestionSuggestion for a built in MSBuild analyzer. Label should be applied together with 'Area: BuildCheck'Feature: Warning WavesWarnings to enable in opt-in waves. Formerly "strict mode".backlogtriaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions