Skip to content

Commit 3028ee9

Browse files
authored
Remove unnecessary ref source projects from Microsoft.Bcl packages (#105312)
* Remove unused reference assembly projects from Bcl folders Contributes to #58163 - Remove unused reference assembly projects and move the forwards.cs files into the src folder. - Don't rely on IsPartialFacadeAssembly switch anymore which makes it possible to use the compiler generated xml file and removes the dependency on the reference source project. - Enable package baseline validation for Microsoft.Bcl.Numerics This improves restore and build perf in total as well as per leaf project on the CLI and inside VS. * Update project references - Update projects that now need to reference the src project as the ref project got deleted. - Remove target that validates that ref projects only reference ref project. That target doesn't make sense anymore with our direction towards removing reference assembly projects.
1 parent 53d1a6d commit 3028ee9

32 files changed

Lines changed: 114 additions & 581 deletions

File tree

Directory.Build.targets

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,10 @@
9797
<Error Text="The passed-in TargetOS property value '$(TargetOS)' must be lowercase." />
9898
</Target>
9999

100-
<ItemDefinitionGroup>
101-
<TargetPathWithTargetPlatformMoniker>
102-
<IsReferenceAssemblyProject>$(IsReferenceAssemblyProject)</IsReferenceAssemblyProject>
103-
</TargetPathWithTargetPlatformMoniker>
104-
</ItemDefinitionGroup>
105-
106-
<Target Name="ValidateReferenceAssemblyProjectReferencesAndTargetFramework"
107-
AfterTargets="ResolveReferences"
100+
<Target Name="ValidateReferenceAssemblyProjectTargetFramework"
101+
BeforeTargets="CoreCompile"
108102
Condition="'$(IsReferenceAssemblyProject)' == 'true' and
109103
'$(SkipValidateReferenceAssemblyProjectReferences)' != 'true'">
110-
<Error Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'."
111-
Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferencePath.IsReferenceAssemblyProject)' != 'true' and '%(ReferencePath.ReferenceAssembly)' == ''" />
112104
<Error Text="Reference assemblies must be TargetPlatform agnostic. $(MSBuildProjectName) incorrectly targets $(TargetFramework), platform: $(TargetPlatformIdentifier)."
113105
Condition="'$(TargetPlatformIdentifier)' != ''" />
114106
</Target>

src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.cs

Lines changed: 0 additions & 96 deletions
This file was deleted.

src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.Forwards.cs renamed to src/libraries/Microsoft.Bcl.AsyncInterfaces/src/Microsoft.Bcl.AsyncInterfaces.Forwards.cs

File renamed without changes.

src/libraries/Microsoft.Bcl.AsyncInterfaces/src/Microsoft.Bcl.AsyncInterfaces.csproj

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,37 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1</TargetFrameworks>
5-
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
65
<IsPackable>true</IsPackable>
76
<!-- This assembly should never be placed inbox as it is only for downlevel compatibility. -->
8-
<PackageDescription>Provides the IAsyncEnumerable&lt;T&gt; and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.
9-
10-
Commonly Used Types:
11-
System.IAsyncDisposable
12-
System.Collections.Generic.IAsyncEnumerable
13-
System.Collections.Generic.IAsyncEnumerator</PackageDescription>
7+
<PackageDescription>Provides the IAsyncEnumerable&lt;T&gt; and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.</PackageDescription>
148
</PropertyGroup>
159

16-
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
17-
<PropertyGroup>
18-
<IsPartialFacadeAssembly Condition="'$(TargetFramework)' == 'netstandard2.1'">true</IsPartialFacadeAssembly>
19-
</PropertyGroup>
10+
<Choose>
11+
<When Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1'))">
12+
<ItemGroup>
13+
<Compile Include="Microsoft.Bcl.AsyncInterfaces.Forwards.cs" />
14+
</ItemGroup>
15+
</When>
2016

21-
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
22-
<Compile Include="System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs" />
23-
<Compile Include="System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs" />
24-
<Compile Include="$(CoreLibSharedDir)\System\Collections\Generic\IAsyncEnumerable.cs">
25-
<Link>System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerable.cs</Link>
26-
</Compile>
27-
<Compile Include="$(CoreLibSharedDir)\System\Collections\Generic\IAsyncEnumerator.cs">
28-
<Link>System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerator.cs</Link>
29-
</Compile>
30-
<Compile Include="$(CoreLibSharedDir)\System\IAsyncDisposable.cs">
31-
<Link>System.Private.CoreLib\System\IAsyncDisposable.cs</Link>
32-
</Compile>
33-
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs">
34-
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs</Link>
35-
</Compile>
36-
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs">
37-
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs</Link>
38-
</Compile>
39-
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs">
40-
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs</Link>
41-
</Compile>
42-
<Compile Include="$(CoreLibSharedDir)\System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs">
43-
<Link>System.Private.CoreLib\System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs</Link>
44-
</Compile>
45-
<Compile Include="$(CoreLibSharedDir)\System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs">
46-
<Link>System.Private.CoreLib\System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs</Link>
47-
</Compile>
17+
<Otherwise>
18+
<ItemGroup>
19+
<Compile Include="System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs" />
20+
<Compile Include="System\Runtime\CompilerServices\AsyncIteratorMethodBuilder.cs" />
4821

49-
</ItemGroup>
22+
<Compile Include="$(CoreLibSharedDir)System\Collections\Generic\IAsyncEnumerable.cs" Link="System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerable.cs" />
23+
<Compile Include="$(CoreLibSharedDir)System\Collections\Generic\IAsyncEnumerator.cs" Link="System.Private.CoreLib\System\Collections\Generic\IAsyncEnumerator.cs" />
24+
<Compile Include="$(CoreLibSharedDir)System\IAsyncDisposable.cs" Link="System.Private.CoreLib\System\IAsyncDisposable.cs" />
25+
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\AsyncIteratorStateMachineAttribute.cs" />
26+
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredAsyncDisposable.cs" />
27+
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\ConfiguredCancelableAsyncEnumerable.cs" />
28+
<Compile Include="$(CoreLibSharedDir)System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs" Link="System.Private.CoreLib\System\Threading\Tasks\TaskAsyncEnumerableExtensions.cs" />
29+
<Compile Include="$(CoreLibSharedDir)System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs" Link="System.Private.CoreLib\System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs" />
30+
</ItemGroup>
5031

51-
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
52-
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" />
53-
</ItemGroup>
32+
<ItemGroup>
33+
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" />
34+
</ItemGroup>
35+
</Otherwise>
36+
</Choose>
5437

5538
</Project>

0 commit comments

Comments
 (0)