You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,20 +26,16 @@ If you're using [Central Package Management](https://learn.microsoft.com/en-us/n
26
26
```
27
27
28
28
### C#
29
-
You'll need to enable C# documentation XML generation to ensure good analysis results. If your repo is not already using docxml globally, this can introduce a large number of errors and warnings specific to docxml. Additionally, turning on docxml adds additional output I/O that can slow down large repos.
29
+
You'll need to enable C# documentation XML generation to ensure good analysis results (RT0000 will fire if it's not enabled). If your repo is not already using docxml globally, this can introduce a large number of errors and warnings specific to docxml. Additionally, turning on docxml adds additional output I/O that can slow down large repos.
30
30
31
-
You can turn off specific docxml related warnings and errors while defaulting ReferenceTrimmer to off using a block of code like this in your `Directory.Build.props`. Turn on the ReferenceTrimmer build by setting `/p:EnableReferenceTrimmer=true` on the MSBuild command line or setting the same property value as an environment variable. You could create a separate build pipeline for your repo to run ReferenceTrimmer builds.
31
+
If your repo does not already set `<GenerateDocumentationFile>` to `true`, add the following to your `Directory.Build.props` to enable it and suppress related warnings:
32
32
33
33
```xml
34
-
<!-- ReferenceTrimmer - run build with /p:EnableReferenceTrimmer=true to enable -->
<!-- Suppress XML doc comment issues to avoid errors during ReferenceTrimmer:
38
+
<!-- Suppress XML doc comment issues:
43
39
- CS0419: Ambiguous reference in cref attribute
44
40
- CS1570: XML comment has badly formed XML
45
41
- CS1573: Parameter has no matching param tag in the XML comment
@@ -52,7 +48,7 @@ You can turn off specific docxml related warnings and errors while defaulting Re
52
48
</PropertyGroup>
53
49
```
54
50
55
-
Note: To get better results, enable the [`IDE0005`](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005) unnecessary `using` rule. This avoids the C# compiler seeing a false positive assembly usage from unneeded `using` directives causing it to miss a removable dependency. See also the note for why IDE0005 code analysis rule requires `<GenerateDocumentationFile>`property to be enabled. Documentation generation is also required for accuracy of used references detection (based onhttps://github.com/dotnet/roslyn/issues/66188).
51
+
Note: To get better results, enable the [`IDE0005`](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005) unnecessary `using` rule. This prevents the C# compiler from seeing false positive assembly usage from unneeded `using` directives, which could cause it to miss a removable dependency. Note that IDE0005 also requires `<GenerateDocumentationFile>` to be enabled. Documentation generation is also required for accuracy of used references detection (seehttps://github.com/dotnet/roslyn/issues/66188).
56
52
57
53
#### What makes a reference non-trimmable?
58
54
@@ -142,6 +138,14 @@ Alternatively, you can add `TreatAsUsed` metadata to suppress all ReferenceTrimm
142
138
## Configuration
143
139
`$(EnableReferenceTrimmer)` - Controls whether the build logic should run for a given project. Defaults to `true`.
144
140
141
+
To make ReferenceTrimmer opt-in rather than always-on, you can default it to `false` in your `Directory.Build.props` and enable it via `/p:EnableReferenceTrimmer=true` on the MSBuild command line or as an environment variable. You could also create a separate build pipeline for your repo to run ReferenceTrimmer builds.
`$(ReferenceTrimmerEnableVcxproj)` - Controls whether MSVC link flags are set up to print out unused libraries and delay-load DLLs. Defaults to `true`.
146
150
147
151
`$(EnableReferenceTrimmerDiagnostics)` - When set to `true`, writes used and unused reference lists to the intermediate output directory for debugging. Defaults to `false`.
0 commit comments