Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/CsSig/Analyzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ All `*.cssig` files in the project are included automatically and together defin
API surface. Set `<EnableCsSigAnalyzer>false</EnableCsSigAnalyzer>` to opt out. A project with no
`.cssig` files enforces nothing.

For multi-targeted projects, name a file `<name>.<tfm>.cssig` (e.g. `PublicApi.net8.0.cssig`) to
apply it only when building that target framework. Unqualified files (e.g. `PublicApi.cssig`) apply
to every TFM, so put the shared surface there and the TFM-specific surface in qualified files.

You don't write the file by hand: create an empty `PublicApi.cssig`, build (every public member reports
`CSSIG002`), then invoke the code fix → **Fix all** to generate it from the current surface. Apply
the same fix to keep it current as the API grows.
Expand Down
15 changes: 15 additions & 0 deletions src/CsSig/Analyzer/build/StaticCS.CsSig.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@
Include="**/*.cssig"
Exclude="$(BaseIntermediateOutputPath)**/*.cssig;$(BaseOutputPath)**/*.cssig;bin/**/*.cssig;obj/**/*.cssig"
/>

<!--
Per-TFM signatures: a `<name>.<tfm>.cssig` file (e.g. PublicApi.net8.0.cssig) applies only
to that target framework. Drop every TFM-qualified file, then re-add the ones for the TFM
currently building, so multi-targeted projects can declare a distinct surface per TFM.
-->
<AdditionalFiles
Remove="**/*.net*.cssig;**/*.netstandard*.cssig;**/*.netcoreapp*.cssig"
Condition="'$(TargetFramework)' != ''"
/>
<AdditionalFiles
Include="**/*.$(TargetFramework).cssig"
Exclude="$(BaseIntermediateOutputPath)**/*.cssig;$(BaseOutputPath)**/*.cssig;bin/**/*.cssig;obj/**/*.cssig"
Condition="'$(TargetFramework)' != ''"
/>
</ItemGroup>

<!--
Expand Down
Loading