Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ericsampson opened this issue Jun 24, 2024 · 1 comment
Labels
Area-NetSDK Feature Request msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer

Comments

@ericsampson
Copy link

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 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

?

@baronfel
Copy link
Member

I'm going to move this to dotnet/sdk because all of the AssemblyInfo generation logic is provided by the SDK.

@baronfel baronfel transferred this issue from dotnet/msbuild Jun 24, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Jun 24, 2024
@baronfel baronfel added msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer and removed untriaged Request triage from a team member labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK Feature Request msbuild-analyzer-candidate Items that would be a good MSBuild Analyzer
Projects
None yet
Development

No branches or pull requests

2 participants