forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
references.targets
62 lines (56 loc) · 3.26 KB
/
references.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<Project>
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<!--
Disable RAR from transitively discovering dependencies for references. This is required as we don't copy
dependencies over into the output directory which means RAR can't resolve them.
-->
<_FindDependencies>false</_FindDependencies>
</PropertyGroup>
<!-- If a CoreLib ProjectReference is present, make all P2P assets non transitive. -->
<ItemGroup Condition="'@(ProjectReference)' != '' and
@(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))">
<ProjectReference Update="@(ProjectReference)"
PrivateAssets="all" />
</ItemGroup>
<!-- Project references shouldn't be copied to the output for non test apps. -->
<ItemDefinitionGroup Condition="'$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'">
<ProjectReference>
<Private>false</Private>
</ProjectReference>
</ItemDefinitionGroup>
<!-- Filter out transitive P2Ps which should be excluded. -->
<Target Name="FilterTransitiveProjectReferences"
AfterTargets="IncludeTransitiveProjectReferences"
Condition="'$(DisableTransitiveProjectReferences)' != 'true' and
'@(DefaultReferenceExclusion)' != ''">
<ItemGroup>
<_transitiveProjectReferenceWithExclusion Include="@(ProjectReference)">
<Exclusion>%(DefaultReferenceExclusion.Identity)</Exclusion>
</_transitiveProjectReferenceWithExclusion>
<ProjectReference Remove="@(_transitiveProjectReferenceWithExclusion)"
Condition="'%(_transitiveProjectReferenceWithExclusion.NuGetPackageId)' == '%(_transitiveProjectReferenceWithExclusion.Exclusion)'" />
</ItemGroup>
</Target>
<!-- Make shared framework assemblies not app-local (non private). -->
<Target Name="UpdateProjectReferencesWithPrivateAttribute"
AfterTargets="AssignProjectConfiguration"
BeforeTargets="PrepareProjectReferences"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
('$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true') and
'@(ProjectReferenceWithConfiguration)' != ''">
<ItemGroup>
<ProjectReferenceWithConfiguration PrivateAssets="all"
Private="false"
Condition="$(NetCoreAppLibrary.Contains('%(Filename);'))" />
</ItemGroup>
</Target>
<ItemDefinitionGroup>
<TargetPathWithTargetPlatformMoniker>
<IsReferenceAssembly>$(IsReferenceAssembly)</IsReferenceAssembly>
</TargetPathWithTargetPlatformMoniker>
</ItemDefinitionGroup>
<Target Name="ValidateReferenceAssemblyProjectReferences" Condition="'$(IsReferenceAssembly)' == 'true'" AfterTargets="ResolveReferences">
<Error Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' AND '%(ReferencePath.IsReferenceAssembly)' != 'true' AND '%(ReferencePath.ReferenceAssembly)' == ''"
Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'." />
</Target>
</Project>