Skip to content

[BuildCheck Suggestion]: Well-known properties applied as item metadata #10516

Open
@rainersigwald

Description

@rainersigwald

Summary

It'd be great if we could scan for some patterns where a property (that we know about) is set instead as item metadata.

Background and Motivation

"Things" in MSBuild are properties, items, or metadata on specific items. But if you hear "set X", it's hard to know which category X is in, and easy to make mistakes.

Sample issue or antipattern that the check should be flagging

An anonymous dev hit some trouble with a NuGet package and tried to fix it by doing this

    <PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.13" >
      <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    </PackageReference>

Looks convincing! But it's wrong, because CopyLocalLockFileAssemblies is a project property, not a per-package setting. Sure would be nice if MSBuild could help.

Sample output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions