Skip to content

Commit e052587

Browse files
authored
Various infra improvements (#1191)
- Simplify FilterImplicitAssemblyReferences target - Add comments to a few settings - Add missing aspnetcore KnownFrameworkReference targeting pack setting - Disable P2Ps getting copied to a lib's output which makes the build significantly faster. - Move the _FindDependencies property from props to targets and extend the comment on why the setting is necessary.
1 parent aa3e9de commit e052587

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/referencePackages/Directory.Build.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
<LangVersion>latest</LangVersion>
3535

3636
<CommonSrc>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'common'))</CommonSrc>
37-
38-
<!-- Make RAR not unify assembly dependencies. This is necessary to make P2Ps with same package ids but different versions work. -->
39-
<_FindDependencies>false</_FindDependencies>
4037
</PropertyGroup>
4138

4239
<PropertyGroup>

src/referencePackages/Directory.Build.targets

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
<Import Project="..\..\Directory.Build.targets" />
44

55
<PropertyGroup>
6+
<!-- Disable RAR from transitively discovering dependencies for references. This is required as we don't copy
7+
dependencies over into the output directory which means RAR can't resolve them.
8+
This is also necessary to make P2Ps with same package ids but different versions work. -->
9+
<_FindDependencies>false</_FindDependencies>
10+
611
<CustomizationsPropsPath>$(MSBuildProjectDirectory)\$(CustomizationsPropsFile)</CustomizationsPropsPath>
712
<CustomizationsSourcePath>$(MSBuildProjectDirectory)\$(CustomizationsSourceFile)</CustomizationsSourcePath>
813
</PropertyGroup>
914

15+
<!-- Project references don't need to be copied to the output. That makes the build significantly faster. -->
16+
<ItemDefinitionGroup>
17+
<ProjectReference>
18+
<Private>false</Private>
19+
</ProjectReference>
20+
</ItemDefinitionGroup>
21+
1022
<ItemGroup>
1123
<Compile Include="ref/$(TargetFramework)/*$(DefaultLanguageSourceExtension)" />
1224
<Compile Include="lib/$(TargetFramework)/*$(DefaultLanguageSourceExtension)" />
@@ -21,23 +33,24 @@
2133
<!-- Customization extension point -->
2234
<Import Project="$(CustomizationsPropsPath)" Condition="Exists('$(CustomizationsPropsPath)')" />
2335

24-
<!--
25-
### Targeting Packs section ###
26-
Keep in sync with available targeting packs under src/targetPacks/ILsrc.
27-
-->
28-
2936
<PropertyGroup>
37+
<!-- Avoid transitive framework reference downloads to minimize the number of targeting packs and prebuilts. -->
3038
<DisableTransitiveFrameworkReferenceDownloads>true</DisableTransitiveFrameworkReferenceDownloads>
3139
<!-- The SDK already sets the NETStandardImplicitPackageVersion and we don't expect it to change anymore. Hence, we don't encode it here. -->
3240
</PropertyGroup>
3341

42+
<!-- Keep in sync with available targeting packs under src/targetPacks/ILsrc. -->
3443
<ItemGroup>
3544
<KnownFrameworkReference Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App'))">
3645
<TargetingPackVersion Condition="'%(TargetFramework)' == 'netcoreapp3.0'">3.0.0</TargetingPackVersion>
3746
<TargetingPackVersion Condition="'%(TargetFramework)' == 'netcoreapp3.1'">3.1.0</TargetingPackVersion>
3847
<TargetingPackVersion Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(TargetFramework)', '^net\d+\.0$'))">$([System.Text.RegularExpressions.Regex]::Match('%(TargetFramework)', '\d+').Value).0.0</TargetingPackVersion>
3948
</KnownFrameworkReference>
4049

50+
<KnownFrameworkReference Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App'))">
51+
<TargetingPackVersion Condition="'%(TargetFramework)' == 'net6.0'">6.0.2</TargetingPackVersion>
52+
</KnownFrameworkReference>
53+
4154
<KnownFrameworkReference Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'NETStandard.Library'))">
4255
<TargetingPackVersion Condition="'%(TargetFramework)' == 'netstandard2.1'">2.1.0</TargetingPackVersion>
4356
</KnownFrameworkReference>
@@ -58,22 +71,12 @@
5871
DependsOnTargets="ResolveProjectReferences"
5972
AfterTargets="ResolveTargetingPackAssets">
6073
<ItemGroup>
61-
<_targetingPackReferenceExclusion Include="$(TargetName)" />
62-
</ItemGroup>
63-
<ItemGroup>
64-
<_targetingPackReferenceWithProjectName Include="@(Reference->WithMetadataValue('ExternallyResolved', 'true')->Metadata('Filename'))"
65-
OriginalIdentity="%(Identity)" />
66-
<_targetingPackIncludedReferenceWithProjectName Include="@(_targetingPackReferenceWithProjectName)"
67-
Exclude="@(_targetingPackReferenceExclusion)" />
68-
<_targetingPackExcludedReferenceWithProjectName Include="@(_targetingPackReferenceWithProjectName)"
69-
Exclude="@(_targetingPackIncludedReferenceWithProjectName)" />
70-
<Reference Remove="@(_targetingPackExcludedReferenceWithProjectName->Metadata('OriginalIdentity'))" />
74+
<Reference Remove="@(Reference->WithMetadataValue('ExternallyResolved', 'true')->WithMetadataValue('Filename', '$(TargetName)'))" />
7175
</ItemGroup>
7276
</Target>
7377

7478
<Target Name="CopyBuildOutputToTempOutput"
7579
AfterTargets="CopyFilesToOutputDirectory">
76-
7780
<ItemGroup>
7881
<CompileWithRelativePath Include="@(Compile)" Condition="!$([System.String]::new('%(Identity)').StartsWith('%(RootDir)'))" />
7982
</ItemGroup>

0 commit comments

Comments
 (0)