Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/coding-guidelines/libraries-packaging.md6
-rw-r--r--docs/coding-guidelines/project-guidelines.md1
-rw-r--r--eng/generators.targets17
-rw-r--r--eng/packaging.targets15
-rw-r--r--src/libraries/Directory.Build.targets23
-rw-r--r--src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj6
-rw-r--r--src/libraries/Microsoft.Internal.Runtime.AspNetCore.Transport/src/Microsoft.Internal.Runtime.AspNetCore.Transport.proj11
-rw-r--r--src/libraries/NetCoreAppLibrary.props7
-rw-r--r--src/libraries/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj7
-rw-r--r--src/libraries/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj7
-rw-r--r--src/libraries/System.Private.Xml/src/System.Private.Xml.csproj64
-rw-r--r--src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.csproj1
-rw-r--r--src/libraries/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj9
-rw-r--r--src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj13
-rw-r--r--src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj1
-rw-r--r--src/libraries/System.Text.Json/src/System.Text.Json.csproj9
-rw-r--r--src/libraries/System.Text.RegularExpressions/gen/System.Text.RegularExpressions.Generator.csproj1
-rw-r--r--src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj3
-rw-r--r--src/libraries/sfx-gen.proj20
-rw-r--r--src/libraries/sfx.proj10
20 files changed, 137 insertions, 94 deletions
diff --git a/docs/coding-guidelines/libraries-packaging.md b/docs/coding-guidelines/libraries-packaging.md
index fd499428954..59f80488dd5 100644
--- a/docs/coding-guidelines/libraries-packaging.md
+++ b/docs/coding-guidelines/libraries-packaging.md
@@ -14,7 +14,7 @@ In some occasions we may want to include a library in the shared framework, but
Libraries included in the shared framework should ensure all direct and transitive assembly references are also included in the shared framework. This will be validated as part of the build and errors raised if any dependencies are unsatisfied.
-Source generators and analyzers can be included in the shared framework by specifying `IsNetCoreAppAnalyzer`. These projects should specify `AnalyzerLanguage` as mentioned [below](#analyzers--source-generators).
+Source generators and analyzers can be included in the shared framework by adding their project name into the NetCoreAppLibrary.props file under the `NetCoreAppLibraryGenerator` section. These projects should specify `AnalyzerLanguage` as mentioned [below](#analyzers--source-generators).
Removing a library from the shared framework is a breaking change and should be avoided.
@@ -70,10 +70,10 @@ Build props and targets may be needed in NuGet packages. To define these, author
Some packages may wish to include a companion analyzer or source-generator with their library. Analyzers are much different from normal library contributors: their dependencies shouldn't be treated as nuget package dependencies, their TargetFramework isn't applicable to the project they are consumed in (since they run in the compiler). To facilitate this, we've defined some common infrastructure for packaging Analyzers.
-To include an analyzer in a package, simply add an `AnalyzerReference` item to the project that produces the package that should contain the analyzer
+To include an analyzer in a package, simply add an `AnalyzerReference` item to the project that produces the package that should contain the analyzer and set the `Pack` metadata to true. If you just want to include the analyzer but not consume it, set the `ReferenceAnalyzer` metadata to false.
```xml
<ItemGroup>
- <AnalyzerReference Include="..\gen\System.Banana.Generators.csproj" />
+ <AnalyzerReference Include="..\gen\System.Banana.Generators.csproj" Pack="true" ReferenceAnalyzer="false" />
</ItemGroup>
```
diff --git a/docs/coding-guidelines/project-guidelines.md b/docs/coding-guidelines/project-guidelines.md
index e2b281c6790..a0e37a38831 100644
--- a/docs/coding-guidelines/project-guidelines.md
+++ b/docs/coding-guidelines/project-guidelines.md
@@ -188,6 +188,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 an `<AnalyzerReference Include="..." />` item to the project, usually next to the `References` and `ProjectReferences` items.
## Facades
Facade are unique in that they don't have any code and instead are generated by finding a contract reference assembly with the matching identity and generating type forwards for all the types to where they live in the implementation assemblies (aka facade seeds). There are also partial facades which contain some type forwards as well as some code definitions. All the various build configurations should be contained in the one csproj file per library.
diff --git a/eng/generators.targets b/eng/generators.targets
index 69c3c12cbb4..c123ad66387 100644
--- a/eng/generators.targets
+++ b/eng/generators.targets
@@ -41,17 +41,18 @@
That is required as the EnabledGenerators condition checks on the Reference and ProjectReference items and hence can't be a property condition. -->
<ItemGroup Condition="'@(EnabledGenerators)' != '' and
@(EnabledGenerators->AnyHaveMetadataValue('Identity', 'LibraryImportGenerator'))">
- <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj;
- $(LibrariesProjectRoot)System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj"
- OutputItemType="Analyzer"
- ReferenceOutputAssembly="false" />
+ <AnalyzerReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj;
+ $(LibrariesProjectRoot)System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" />
</ItemGroup>
- <!-- Use a normal property condition as this source generator is opt-in and doesn't read from an item list. -->
- <ItemGroup Condition="'$(EnableRegexGenerator)' == 'true'">
- <ProjectReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj"
+ <!-- AnalyzerReference items are transformed to ProjectReferences with the required analyzer metadata. -->
+ <ItemGroup>
+ <ProjectReference Include="@(AnalyzerReference)"
+ ReferenceOutputAssembly="false"
OutputItemType="Analyzer"
- ReferenceOutputAssembly="false" />
+ Pack="false" />
+ <ProjectReference Update="@(AnalyzerReference->WithMetadataValue('ReferenceAnalyzer', 'false'))"
+ OutputItemType="" />
</ItemGroup>
<Target Name="ConfigureGenerators"
diff --git a/eng/packaging.targets b/eng/packaging.targets
index 1abe280c590..91d72a574c7 100644
--- a/eng/packaging.targets
+++ b/eng/packaging.targets
@@ -137,11 +137,12 @@
</ItemGroup>
</Target>
- <Target Name="IncludeAnalyzersInPackage" Condition="'@(AnalyzerReference)' != ''">
- <!-- Call a target in the analyzer project to get all the files it would normally place in a package.
- These will be returned as items with identity pointing to the built file, and PackagePath metadata
- set to their location in the package. IsSymbol metadata will be set to distinguish symbols. -->
- <MSBuild Projects="@(AnalyzerReference)"
+ <!-- Call a target in the analyzer project to get all the files it would normally place in a package.
+ These will be returned as items with identity pointing to the built file, and PackagePath metadata
+ set to their location in the package. IsSymbol metadata will be set to distinguish symbols. -->
+ <Target Name="IncludeAnalyzersInPackage"
+ Condition="'@(AnalyzerReference)' != '' and @(AnalyzerReference->AnyHaveMetadataValue('Pack', 'true'))">
+ <MSBuild Projects="@(AnalyzerReference->WithMetadataValue('Pack', 'true'))"
Targets="GetAnalyzerPackFiles">
<Output TaskParameter="TargetOutputs" ItemName="_AnalyzerFile" />
</MSBuild>
@@ -165,7 +166,9 @@
<!-- In packages that contain Analyzers, include a .targets file that will select the correct analyzer. -->
<Target Name="IncludeMultiTargetRoslynComponentTargetsInPackage"
AfterTargets="IncludeAnalyzersInPackage"
- Condition="'@(AnalyzerReference)' != '' and '$(IncludeMultiTargetRoslynComponentTargets)' == 'true'"
+ Condition="'@(AnalyzerReference)' != '' and
+ @(AnalyzerReference->AnyHaveMetadataValue('Pack', 'true')) and
+ '$(IncludeMultiTargetRoslynComponentTargets)' == 'true'"
DependsOnTargets="GenerateMultiTargetRoslynComponentTargetsFile">
<ItemGroup>
<Content Include="$(MultiTargetRoslynComponentTargetsFileIntermediatePath)" PackagePath="buildTransitive\netstandard2.0\$(PackageId).targets" />
diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets
index bbb40d64e07..82cd619775c 100644
--- a/src/libraries/Directory.Build.targets
+++ b/src/libraries/Directory.Build.targets
@@ -47,6 +47,8 @@
<IsNETCoreAppRef Condition="('$(IsReferenceAssemblyProject)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true') and
$(NetCoreAppLibrary.Contains('$(AssemblyName);')) and
!$(NetCoreAppLibraryNoReference.Contains('$(AssemblyName);'))">true</IsNETCoreAppRef>
+ <IsNETCoreAppAnalyzer Condition="'$(IsGeneratorProject)' == 'true' and
+ $(NetCoreAppLibraryGenerator.Contains('$(MSBuildProjectName);'))">true</IsNETCoreAppAnalyzer>
<!-- By default, disable implicit framework references for NetCoreAppCurrent libraries. -->
<DisableImplicitFrameworkReferences Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)')) and
@@ -201,25 +203,6 @@
</When>
</Choose>
- <PropertyGroup>
- <BuildAnalyzerReferences>$(BuildProjectReferences)</BuildAnalyzerReferences>
- <BuildAnalyzerReferences Condition="'$(BuildingInsideVisualStudio)' == 'true'">false</BuildAnalyzerReferences>
- </PropertyGroup>
-
- <ItemGroup>
- <!-- Ensure AnalyzerReference items are restored and built
- The target framework of Analyzers has no relationship to that of the refrencing project,
- so we don't apply TargetFramework filters nor do we pass in TargetFramework.
- When BuildProjectReferences=false we make sure to set BuildReference=false to make
- sure not to try to call GetTargetPath in the outerbuild of the analyzer project. -->
- <ProjectReference Include="@(AnalyzerReference)"
- SkipGetTargetFrameworkProperties="true"
- UndefineProperties="TargetFramework"
- ReferenceOutputAssembly="false"
- PrivateAssets="all"
- BuildReference="$(BuildAnalyzerReferences)" />
- </ItemGroup>
-
<Target Name="GetAnalyzerPackFiles"
DependsOnTargets="$(GenerateNuspecDependsOn)"
Returns="@(_AnalyzerPackFile)">
@@ -228,11 +211,13 @@
<_analyzerPath Condition="'$(AnalyzerRoslynVersion)' != ''">$(_analyzerPath)/roslyn$(AnalyzerRoslynVersion)</_analyzerPath>
<_analyzerPath Condition="'$(AnalyzerLanguage)' != ''">$(_analyzerPath)/$(AnalyzerLanguage)</_analyzerPath>
</PropertyGroup>
+
<ItemGroup>
<_AnalyzerPackFile Include="@(_BuildOutputInPackage)" IsSymbol="false" />
<_AnalyzerPackFile Include="@(_TargetPathsToSymbols)" IsSymbol="true" />
<_AnalyzerPackFile PackagePath="$(_analyzerPath)/%(TargetPath)" />
</ItemGroup>
+
<Error Condition="'%(_AnalyzerPackFile.TargetFramework)' != 'netstandard2.0'"
Text="Analyzers must only target netstandard2.0 since they run in the compiler which targets netstandard2.0. The following files were found to target '%(_AnalyzerPackFile.TargetFramework)': @(_AnalyzerPackFile)" />
</Target>
diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj
index b2eddd1426a..bcc77451fa5 100644
--- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj
+++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj
@@ -38,8 +38,12 @@ Microsoft.Extensions.Logging.Abstractions.NullLogger</PackageDescription>
<ItemGroup>
<AnalyzerReference Include="..\gen\Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj"
+ Pack="true"
+ ReferenceAnalyzer="false"
Condition="'$(DotNetBuildFromSource)' != 'true'" />
- <AnalyzerReference Include="..\gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj" />
+ <AnalyzerReference Include="..\gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj"
+ Pack="true"
+ ReferenceAnalyzer="false" />
</ItemGroup>
</Project>
diff --git a/src/libraries/Microsoft.Internal.Runtime.AspNetCore.Transport/src/Microsoft.Internal.Runtime.AspNetCore.Transport.proj b/src/libraries/Microsoft.Internal.Runtime.AspNetCore.Transport/src/Microsoft.Internal.Runtime.AspNetCore.Transport.proj
index e1a5a2f8077..ac7c88c1b9f 100644
--- a/src/libraries/Microsoft.Internal.Runtime.AspNetCore.Transport/src/Microsoft.Internal.Runtime.AspNetCore.Transport.proj
+++ b/src/libraries/Microsoft.Internal.Runtime.AspNetCore.Transport/src/Microsoft.Internal.Runtime.AspNetCore.Transport.proj
@@ -18,9 +18,14 @@
<ItemGroup>
<!-- Requires Private=true to calculate ReferenceCopyLocalPaths items. Also share System.Net.Quic which isn't part of aspnetcore's shared framework but which is needed by them. -->
<ProjectReference Include="@(AspNetCoreAppLibrary->'$(LibrariesProjectRoot)%(Identity)\src\%(Identity).csproj');
- $(LibrariesProjectRoot)System.Net.Quic\src\System.Net.Quic.csproj" PrivateAssets="all" Pack="true" Private="true" IncludeReferenceAssemblyInPackage="true" />
- <!-- TODO: Find a better way to include source generators without hardcoding them. -->
+ $(LibrariesProjectRoot)System.Net.Quic\src\System.Net.Quic.csproj"
+ Pack="true"
+ PrivateAssets="all"
+ Private="true"
+ IncludeReferenceAssemblyInPackage="true" />
<!-- Only include the 4.0 version in the ref pack, since targeting net6.0 requires Roslyn 4.0 -->
- <AnalyzerReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj" />
+ <AnalyzerReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj"
+ Pack="true"
+ ReferenceAnalyzer="false" />
</ItemGroup>
</Project>
diff --git a/src/libraries/NetCoreAppLibrary.props b/src/libraries/NetCoreAppLibrary.props
index 66e816eed49..6384dea850c 100644
--- a/src/libraries/NetCoreAppLibrary.props
+++ b/src/libraries/NetCoreAppLibrary.props
@@ -183,6 +183,12 @@
System.Private.Xml;
System.Private.Xml.Linq;
</NetCoreAppLibraryNoReference>
+ <!-- List .NETCoreApp shared framework generator project names below. -->
+ <NetCoreAppLibraryGenerator>
+ LibraryImportGenerator;
+ System.Text.Json.SourceGeneration.Roslyn4.0;
+ System.Text.RegularExpressions.Generator;
+ </NetCoreAppLibraryGenerator>
<AspNetCoreAppLibrary>
Microsoft.Extensions.Caching.Abstractions;
Microsoft.Extensions.Caching.Memory;
@@ -245,6 +251,7 @@
<NetFxReference Include="$(NetFxReference)" />
<NetCoreAppLibrary Include="$(NetCoreAppLibrary)" />
<NetCoreAppLibraryNoReference Include="$(NetCoreAppLibraryNoReference)" />
+ <NetCoreAppLibraryGenerator Include="$(NetCoreAppLibraryGenerator)" />
<AspNetCoreAppLibrary Include="$(AspNetCoreAppLibrary)" />
<WindowsDesktopCoreAppLibrary Include="$(WindowsDesktopCoreAppLibrary)" />
</ItemGroup>
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj b/src/libraries/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
index 205f992960a..d3ac144be89 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
- <EnableRegexGenerator>true</EnableRegexGenerator>
</PropertyGroup>
+
<ItemGroup>
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.xml" />
</ItemGroup>
+
<ItemGroup>
<Compile Include="MS\Internal\Xml\Linq\ComponentModel\XComponentModel.cs" />
<Compile Include="System\ComponentModel\ArrayConverter.cs" />
@@ -238,7 +239,9 @@
<Compile Include="System\ComponentModel\ComponentResourceManager.cs" />
<Compile Include="System\Security\Authentication\ExtendedProtection\ExtendedProtectionPolicyTypeConverter.cs" />
</ItemGroup>
+
<ItemGroup>
+ <AnalyzerReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj" />
<Reference Include="System.Collections" />
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.Collections.Specialized" />
diff --git a/src/libraries/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj b/src/libraries/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj
index 89790d1e9fe..f8df7d3599d 100644
--- a/src/libraries/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj
+++ b/src/libraries/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<NoWarn>$(NoWarn);1634;1691;649</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<!-- Too much private reflection. Do not bother with trimming -->
<ILLinkTrimAssembly>false</ILLinkTrimAssembly>
- <EnableRegexGenerator>true</EnableRegexGenerator>
</PropertyGroup>
+
<PropertyGroup>
<RuntimeSerializationSources>System\Runtime\Serialization</RuntimeSerializationSources>
<JsonSources>System\Runtime\Serialization\Json</JsonSources>
<XmlSources>System\Xml</XmlSources>
<TextSources>System\Text</TextSources>
</PropertyGroup>
+
<ItemGroup>
<Compile Include="$(CommonPath)System\NotImplemented.cs"
Link="Common\System\NotImplemented.cs" />
@@ -149,7 +150,9 @@
<Compile Include="System\Xml\XmlCanonicalWriter.cs" />
<Compile Include="System\Xml\XmlSigningNodeWriter.cs" />
</ItemGroup>
+
<ItemGroup>
+ <AnalyzerReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj" />
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" />
<Reference Include="System.Collections.NonGeneric" />
diff --git a/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj b/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj
index 1d5bcf5ce80..96b04330623 100644
--- a/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj
+++ b/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)</TargetFrameworks>
<RootNamespace>System.Xml</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)</TargetFrameworks>
- <EnableRegexGenerator>true</EnableRegexGenerator>
</PropertyGroup>
+
<ItemGroup>
<Compile Include="$(CommonPath)System\Text\StringBuilderCache.cs" Link="Common\System\StringBuilderCache.cs" />
<Compile Include="$(CommonPath)System\HexConverter.cs" Link="Common\System\HexConverter.cs" />
@@ -515,6 +515,7 @@
<Compile Include="System\Xml\Serialization\Configuration\DateTimeSerializationSection.cs" />
<Compile Include="System\Xml\Serialization\Globals.cs" />
</ItemGroup>
+
<!-- Embedded DTD files -->
<ItemGroup>
<EmbeddedResource Include="Utils\DTDs\XHTML10\no_comments\xhtml1-strict.dtd">
@@ -539,34 +540,7 @@
<LogicalName>rss-0.91.dtd</LogicalName>
</EmbeddedResource>
</ItemGroup>
- <ItemGroup>
- <Reference Include="System.Reflection.Emit" />
- <Reference Include="System.Reflection.Emit.ILGeneration" />
- <Reference Include="System.Reflection.Emit.Lightweight" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="System.Collections" />
- <Reference Include="System.Collections.Concurrent" />
- <Reference Include="System.Collections.NonGeneric" />
- <Reference Include="System.Collections.Specialized" />
- <Reference Include="System.Console" />
- <Reference Include="System.Diagnostics.TraceSource" />
- <Reference Include="System.Diagnostics.Tracing" />
- <Reference Include="System.Linq.Expressions" />
- <Reference Include="System.Memory" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Net.Primitives" />
- <Reference Include="System.ObjectModel" />
- <Reference Include="System.Reflection.Primitives" />
- <Reference Include="System.Runtime" />
- <Reference Include="System.Runtime.InteropServices" />
- <Reference Include="System.Runtime.Loader" />
- <Reference Include="System.Security.Cryptography" />
- <Reference Include="System.Text.Encoding.Extensions" />
- <Reference Include="System.Text.RegularExpressions" />
- <Reference Include="System.Threading" />
- <Reference Include="System.Threading.Thread" />
- </ItemGroup>
+
<ItemGroup>
<Compile Include="System\Xml\Xsl\IlGen\GenerateHelper.cs" />
<Compile Include="System\Xml\Xsl\IlGen\IteratorDescriptor.cs" />
@@ -775,11 +749,41 @@
<Compile Include="$(CommonPath)System\Text\ValueStringBuilder.cs" Link="Common\System\Text\ValueStringBuilder.cs" />
<Compile Include="$(CommonPath)System\Text\ValueStringBuilder.AppendSpanFormattable.cs" Link="Common\System\Text\ValueStringBuilder.AppendSpanFormattable.cs" />
</ItemGroup>
+
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
<Compile Include="System\Xml\Xsl\Runtime\XmlCollation.Windows.cs" />
</ItemGroup>
+
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == ''">
<Compile Include="System\Xml\Xsl\Runtime\XmlCollation.Unix.cs" />
<Compile Include="System\Xml\Core\XmlTextReaderImpl.Unix.cs" />
</ItemGroup>
+
+ <ItemGroup>
+ <AnalyzerReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj" />
+ <Reference Include="System.Collections" />
+ <Reference Include="System.Collections.Concurrent" />
+ <Reference Include="System.Collections.NonGeneric" />
+ <Reference Include="System.Collections.Specialized" />
+ <Reference Include="System.Console" />
+ <Reference Include="System.Diagnostics.TraceSource" />
+ <Reference Include="System.Diagnostics.Tracing" />
+ <Reference Include="System.Linq.Expressions" />
+ <Reference Include="System.Memory" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Net.Primitives" />
+ <Reference Include="System.ObjectModel" />
+ <Reference Include="System.Reflection.Emit" />
+ <Reference Include="System.Reflection.Emit.ILGeneration" />
+ <Reference Include="System.Reflection.Emit.Lightweight" />
+ <Reference Include="System.Reflection.Primitives" />
+ <Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.InteropServices" />
+ <Reference Include="System.Runtime.Loader" />
+ <Reference Include="System.Security.Cryptography" />
+ <Reference Include="System.Text.Encoding.Extensions" />
+ <Reference Include="System.Text.RegularExpressions" />
+ <Reference Include="System.Threading" />
+ <Reference Include="System.Threading.Thread" />
+ </ItemGroup>
</Project>
diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.csproj b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.csproj
index 39641441b15..f45f50bc410 100644
--- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.csproj
+++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.csproj
@@ -21,7 +21,6 @@
<PackageProjectUrl>https://github.com/dotnet/runtime/tree/main/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator</PackageProjectUrl>
<Description>LibraryImportGenerator</Description>
<PackageTags>LibraryImportGenerator, analyzers</PackageTags>
- <IsNETCoreAppAnalyzer>true</IsNETCoreAppAnalyzer>
</PropertyGroup>
<ItemGroup>
diff --git a/src/libraries/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj b/src/libraries/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
index fa327889859..3038ea25a25 100644
--- a/src/libraries/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
+++ b/src/libraries/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
+ <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
</PropertyGroup>
+
<ItemGroup>
<Compile Include="System\Runtime\CompilerServices\IDispatchConstantAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\IUnknownConstantAttribute.cs" />
@@ -47,13 +48,9 @@
<Compile Include="System\Security\SecureStringMarshal.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" />
</ItemGroup>
+
<ItemGroup>
<ProjectReference Include="$(CoreLibProject)" />
</ItemGroup>
- <ItemGroup>
- <!-- Add the source generator as an analyzer reference so that it gets included in the ref pack.
- See https://github.com/dotnet/runtime/issues/61321 -->
- <AnalyzerReference Include="..\gen\LibraryImportGenerator\LibraryImportGenerator.csproj" />
- </ItemGroup>
</Project>
diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj
index b0ade722e83..89596927bc5 100644
--- a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj
+++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn),1718,SYSLIB0013</NoWarn>
<TestRuntime>true</TestRuntime>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
- <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
<Nullable>disable</Nullable>
<!-- Disable nullability public only feature for NullabilityInfoContextTests -->
<Features>$(Features.Replace('nullablePublicOnly', '')</Features>
- <EnableRegexGenerator>true</EnableRegexGenerator>
</PropertyGroup>
+
<ItemGroup>
<RdXmlFile Include="default.rd.xml" />
</ItemGroup>
+
<ItemGroup>
<Compile Include="$(CommonTestPath)System\EnumTypes.cs" Link="Common\System\EnumTypes.cs" />
<Compile Include="$(CommonTestPath)System\MockType.cs" Link="Common\System\MockType.cs" />
@@ -244,9 +245,11 @@
<Compile Include="System\Type\TypeTests.Get.cs" />
<Compile Include="$(CommonTestPath)System\RandomDataGenerator.cs" Link="Common\System\RandomDataGenerator.cs" />
</ItemGroup>
+
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'Unix' or '$(TargetPlatformIdentifier)' == 'Browser'">
<Compile Include="System\ExitCodeTests.Unix.cs" />
</ItemGroup>
+
<ItemGroup>
<Compile Include="$(CommonTestPath)System\GenericMathHelpers.cs" Link="Common\System\GenericMathHelpers.cs" />
<Compile Include="System\ByteTests.GenericMath.cs" />
@@ -265,6 +268,7 @@
<Compile Include="System\UInt64Tests.GenericMath.cs" />
<Compile Include="System\UIntPtrTests.GenericMath.cs" />
</ItemGroup>
+
<ItemGroup>
<Compile Include="System\Reflection\SignatureTypes.cs" />
<Compile Include="System\Runtime\CompilerServices\CallerArgumentExpressionAttributeTests.cs" />
@@ -288,6 +292,7 @@
<TrimmerRootDescriptor Include="$(ILLinkDescriptorsPath)ILLink.Descriptors.Castle.xml" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
+
<ItemGroup>
<Compile Include="$(CommonTestPath)System\Collections\IEnumerable.Generic.Serialization.Tests.cs" Link="Common\System\Collections\IEnumerable.Generic.Serialization.Tests.cs" />
<EmbeddedResource Include="System\Reflection\EmbeddedImage.png">
@@ -298,9 +303,13 @@
</EmbeddedResource>
<Compile Include="$(CommonTestPath)System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs" Link="Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs" />
</ItemGroup>
+
<ItemGroup>
+ <AnalyzerReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\gen\System.Text.RegularExpressions.Generator.csproj" />
+
<PackageReference Include="Moq" Version="$(MoqVersion)" />
<PackageReference Include="System.Runtime.Numerics.TestData" Version="$(SystemRuntimeNumericsTestDataVersion)" GeneratePathProperty="true" />
+
<ProjectReference Include="TestLoadAssembly\TestLoadAssembly.csproj" />
<ProjectReference Include="TestCollectibleAssembly\TestCollectibleAssembly.csproj" />
<ProjectReference Include="TestModule\System.Reflection.TestModule.ilproj" />
diff --git a/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj
index 5efc9ea5b77..5e50e1e72e1 100644
--- a/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj
+++ b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <IsNETCoreAppAnalyzer>true</IsNETCoreAppAnalyzer>
<AnalyzerRoslynVersion>4.0</AnalyzerRoslynVersion>
<RoslynApiVersion>$(MicrosoftCodeAnalysisVersion_4_0)</RoslynApiVersion>
<DefineConstants>$(DefineConstants);ROSLYN4_0_OR_GREATER</DefineConstants>
diff --git a/src/libraries/System.Text.Json/src/System.Text.Json.csproj b/src/libraries/System.Text.Json/src/System.Text.Json.csproj
index b3bf13f32cd..fcfaa532a0f 100644
--- a/src/libraries/System.Text.Json/src/System.Text.Json.csproj
+++ b/src/libraries/System.Text.Json/src/System.Text.Json.csproj
@@ -381,7 +381,12 @@ System.Text.Json.Nodes.JsonValue</PackageDescription>
</ItemGroup>
<ItemGroup>
- <AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn3.11.csproj" Condition="'$(DotNetBuildFromSource)' != 'true'" />
- <AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn4.0.csproj" />
+ <AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn3.11.csproj"
+ Pack="true"
+ ReferenceAnalyzer="false"
+ Condition="'$(DotNetBuildFromSource)' != 'true'" />
+ <AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn4.0.csproj"
+ Pack="true"
+ ReferenceAnalyzer="false" />
</ItemGroup>
</Project>
diff --git a/src/libraries/System.Text.RegularExpressions/gen/System.Text.RegularExpressions.Generator.csproj b/src/libraries/System.Text.RegularExpressions/gen/System.Text.RegularExpressions.Generator.csproj
index 049e7c5d757..e84f58fa34d 100644
--- a/src/libraries/System.Text.RegularExpressions/gen/System.Text.RegularExpressions.Generator.csproj
+++ b/src/libraries/System.Text.RegularExpressions/gen/System.Text.RegularExpressions.Generator.csproj
@@ -10,7 +10,6 @@
<NoWarn>$(NoWarn);CS0436;CS0649</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);REGEXGENERATOR</DefineConstants>
- <IsNETCoreAppAnalyzer>true</IsNETCoreAppAnalyzer>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<IsPackable>false</IsPackable>
<LangVersion>Preview</LangVersion>
diff --git a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
index 6ced90b035d..927012a1be8 100644
--- a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
+++ b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
@@ -106,8 +106,5 @@
<Reference Include="System.Reflection.Emit.ILGeneration" />
<Reference Include="System.Reflection.Emit.Lightweight" />
<Reference Include="System.Reflection.Primitives" />
-
- <!-- Adding the source generator as an analyzer reference -->
- <AnalyzerReference Include="..\gen\System.Text.RegularExpressions.Generator.csproj" />
</ItemGroup>
</Project>
diff --git a/src/libraries/sfx-gen.proj b/src/libraries/sfx-gen.proj
new file mode 100644
index 00000000000..abb39ade0cb
--- /dev/null
+++ b/src/libraries/sfx-gen.proj
@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.Build.Traversal">
+
+ <PropertyGroup>
+ <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
+ </PropertyGroup>
+
+ <!-- Reference all NetCoreAppCurrent shared framework generator projects. -->
+ <ItemGroup>
+ <AnyProject Include="$(MSBuildThisFileDirectory)*\gen\**\*.*proj"
+ Exclude="@(ProjectExclusions)"
+ OriginalIdentity="%(Identity)" />
+ <AnyProjectWithProjectName Include="@(AnyProject->Metadata('Filename'))" />
+ <NonNetCoreAppProjectWithProjectName Include="@(AnyProjectWithProjectName)"
+ Exclude="@(NetCoreAppLibraryGenerator)" />
+ <NetCoreAppProjectWithProjectName Include="@(AnyProjectWithProjectName)"
+ Exclude="@(NonNetCoreAppProjectWithProjectName)" />
+ <ProjectReference Include="@(NetCoreAppProjectWithProjectName->Metadata('OriginalIdentity'))" />
+ </ItemGroup>
+
+</Project>
diff --git a/src/libraries/sfx.proj b/src/libraries/sfx.proj
index ff1e898d72d..aa345f53952 100644
--- a/src/libraries/sfx.proj
+++ b/src/libraries/sfx.proj
@@ -11,10 +11,12 @@
<ProjectReference Include="sfx-ref.proj">
<OutputItemType Condition="'$(RefOnly)' == 'true'">SharedFrameworkAssembly</OutputItemType>
</ProjectReference>
- <!-- Support building only the reference assemblies. -->
- <ProjectReference Include="sfx-src.proj"
- OutputItemType="SharedFrameworkAssembly"
- Condition="'$(RefOnly)' != 'true'" />
+ </ItemGroup>
+
+ <!-- Support building only the reference assemblies. -->
+ <ItemGroup Condition="'$(RefOnly)' != 'true'">
+ <ProjectReference Include="sfx-src.proj" OutputItemType="SharedFrameworkAssembly" />
+ <ProjectReference Include="sfx-gen.proj" />
</ItemGroup>
<!-- Generate the targeting pack's framework list so that out-of-band projects can leverage it. -->