msbuild
msbuild copied to clipboard
[Built-in analyzer] EmbeddedResource item is missing the Culture metadata
Background
This issue tracks one of the BuildCheck analyzers we would like to ship in-box with MSBuild.
Goal
Implement an analyzer with the following rule: EmbeddedResource
items should not be defined without the Culture
metadatum.
Notes
When Culture
is missing, the culture is inferred from the file name. This is using the culture-name mapping of the currently running .NET runtime, which hurts build reproducibility.
We'll also need good docs that say to do this because it's not the way it's been done for a long time (even though the way it has been done with the "guess at culture based on filename and cultures known to the OS" technique is bad and wrong).
+1 on docs - each of our diagnostics should be able to specify some kind of help link to follow for each recognizable issue, and we should create the pages for each diagnostic (at least in a bare form) as we create them.
It looks like the Culture
metadatum is not documented at all 😮 https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items#embeddedresource
Yeah the docs need here is twofold:
- Tell users they CAN and SHOULD do this.
- The specific page for this analyzer that points to that doc.
Hopefully for most of the analyzers we only need 2 but we should have a policy of checking for/updating 1 for all of them.
I would prefer to not require Culture
be set on individual items when <NeutralLanguage>
is set and the item doesn't have a culture-specific extension.