Skip to content

Commit 8a2cb26

Browse files
authored
Doc for distribution of analyzer config in nuget (#35719)
1 parent ec27d01 commit 8a2cb26

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/fundamentals/code-analysis/configuration-files.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ Consider the following naming recommendations:
9898
> [!NOTE]
9999
> The top-level entry `is_global = true` is not required when the file is named `.globalconfig`, but it is recommended for clarity.
100100
101+
### Distribution in NuGet packages
102+
103+
Global AnalyzerConfig files can be distributed with NuGet packages. To do so, add a [*.props* file](/nuget/concepts/msbuild-props-and-targets) to the NuGet package. In the *.props* file, add a `GlobalAnalyzerConfigFiles` item under the `Project` node:
104+
105+
```xml
106+
<Project>
107+
<ItemGroup>
108+
<GlobalAnalyzerConfigFiles Include="Relative/Path/to/PackageName.globalconfig" />
109+
</ItemGroup>
110+
</Project>
111+
```
112+
101113
### Example
102114

103115
Following is an example global AnalyzerConfig file to configure options and rule severity at the project level:

0 commit comments

Comments
 (0)