msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

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

Open rainersigwald opened this issue 1 year ago • 0 comments

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

rainersigwald avatar Aug 13 '24 20:08 rainersigwald