mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 09:34:49 +09:00
Use analyzers from targeting pack for NetCoreAppCurrent (#87726)
* Use analyzers from targeting pack for NetCoreAppCurrent Fixes that analyzer failures didn't show-up in #74897 Add analyzers to the frameworklist that OOB projects in src/libraries use, and only auto ProjectReference the analyzers in generators.targets when not using the analyzers from the targeting pack. Also move the generator projects related code into a separate file. Continuation of https://github.com/dotnet/runtime/pull/75093 * Fix project build * Add missing reference to Regex tests * Add missing generators for netfx build * Fix paht in test project * Fix typo * Disable runtime marshalling for SharedTypes.csproj * Disable runtime marshalling for NativeExports.csproj
This commit is contained in:
parent
903eef77d6
commit
07ae197db5
31 changed files with 103 additions and 117 deletions
|
@ -185,7 +185,7 @@ All test outputs should be under
|
|||
|
||||
## gen
|
||||
In the gen directory any source generator related to the assembly should exist. This does not mean the source generator is only used for that assembly only that it is conceptually apart of that assembly. For example, the assembly may provide attributes or low-level types the source generator uses.
|
||||
To consume a source generator, simply add a `<ProjectReference Include="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" />` item to the project, usually next to the `Reference` and `ProjectReference` items.
|
||||
To consume a source generator that isn't provided via a targeting pack, simply add a `<ProjectReference Include="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" />` item to the project, usually next to the `Reference` and `ProjectReference` items.
|
||||
|
||||
A source generator must target `netstandard2.0` as such assemblies are loaded into the compiler's process which might run on either .NET Framework or modern .NET depending on the tooling being used (CLI vs Visual Studio). While that's true, a source project can still multi-target and include `$(NetCoreAppToolCurrent)` (which is the latest non live-built .NETCoreApp tfm that is supported by the SDK) to benefit from the ehancanced nullable reference type warnings emitted by the compiler. For an example see [System.Text.Json's roslyn4.4 source generator](/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.4.csproj). While the repository's infrastructure makes sure that only the source generator's `netstandard2.0` build output is included in packages, to consume such a multi-targeting source generator via a `ProjectReference` (as described above), you need to add the `SetTargetFramework="TargetFramework=netstandard2.0"` metadata to the ProjectReference item to guarantee that the netstandard2.0 asset is chosen.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue