dotnet / dotnet/sdk

[Feature Request]: warn if a pack-target assembly property is set but GenerateAssemblyInfo is False

Open
#41,770 1 comment 0 reactions 0 assignees View on GitHub
Area-NetSDK msbuild-analyzer-candidate
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Summary

Add a warning to help users diagnose a scenario where setting assembly properties is getting "ignored".

### Background and Motivation

As a scenario: a large legacy solution has been migrated to the .SDK format, and in some obscure project(s) a previous developer has set `GenerateAssemblyInfo` to False so that an AssemblyInfo.cs file is being used.

At a later time a different developer sets Assembly-related properties via dotnet/msbuild CLI args or Directory.Build.props, and cannot figure out why those properties are getting ignored for some projects. There's no warning printed to the command line, and even creating a binlog and loading it into the binlog viewer doesn't give any hints about why the property settings are getting "ignored" for those assemblies.

### Proposed Feature

If `GenerateAssemblyInfo` is false, then emit a warning if any [pack-target properties](https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target) are set.
(I suppose this would also apply to any of the individual GenerateAssembly*Attribute properties, but that might be getting into pretty rare scenarios 🤷)

### Alternative Designs

?

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.