dotnet / dotnet/msbuild

[BuildCheck Suggestion]: Flag setting AssemblyName in Directory.Build.targets (or other 'core' values being changed after significant usage)

Open
#10,614 1 comment 1 reaction 0 assignees View on GitHub
Area: BuildCheck BuildCheck Suggestion triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

It would be great to be able to detect an anti-pattern of some build assets taking a dependency on a Property or Item metadata and then changing that value in a destructive way later on in the build.

### Background and Motivation

In SDK triage we responded to a user that had set `AssemblyName` to a custom value in their Directory.Build.targets and then was
confused when other build assets had already consumed that value by the time it was set.

### Sample issue or antipattern that the check should be flagging

A simple example would be to create a project and a `Directory.Build.targets` and set `AssemblyName` in the `Directory.Build.targets` then run `dotnet run`.

### Sample output

```
MSB0666 - property changed after being consumed. The property has already been used by at , but was set to at . This change will not be seen by
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.