forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreferences.targets
67 lines (60 loc) · 3.39 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
63
64
65
66
67
<Project>
<PropertyGroup>
<ContractDependencyPaths>$(RefPath)</ContractDependencyPaths>
<FrameworkPathOverride>$(RefPath)</FrameworkPathOverride>
<AssemblySearchPaths>$(AssemblySearchPaths);$(RefPath);{RawFileName}</AssemblySearchPaths>
<!-- Disable RAR from transitively discovering dependencies for References -->
<_FindDependencies>false</_FindDependencies>
<!--
We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder
that exists to skip the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644).
Need to set these after the common targets import.
-->
<_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
</PropertyGroup>
<PropertyGroup Condition="'$(IncludeDefaultReferences)' == ''">
<IncludeDefaultReferences Condition="'$(MSBuildProjectExtension)' == '.csproj'">true</IncludeDefaultReferences>
<IncludeDefaultReferences Condition="'$(MSBuildProjectExtension)' == '.vbproj'">true</IncludeDefaultReferences>
</PropertyGroup>
<Target Name="SetupDefaultReferences">
<ItemGroup Condition="'$(IncludeDefaultReferences)' == 'true'">
<!-- netstandard is a default reference whenever building for NETStandard or building an implementation assembly -->
<DefaultReference Condition="('$(TargetsNetStandard)' == 'true' or '$(IsReferenceAssembly)' != 'true') and Exists('$(RefPath)netstandard.dll')" Include="netstandard" />
</ItemGroup>
</Target>
<Target Name="UpdateReferenceItems" DependsOnTargets="SetupDefaultReferences" BeforeTargets="AddReferencesDynamically">
<ItemGroup>
<Reference Include="@(DefaultReference)" />
</ItemGroup>
<ItemGroup>
<!-- Simple name references will be resolved from the targeting pack folders and should never be copied to output -->
<Reference Condition="'%(Reference.Extension)' != '.dll'">
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>
<Target Name="AddDefaultTestReferences" BeforeTargets="SetupDefaultReferences" Condition="'$(IsTestProject)' == 'true'">
<ItemGroup>
<DefaultReferenceExclusions Include="@(ReferenceFromRuntime)"/>
<!-- Reference everything in the targeting pack directory -->
<DefaultReferenceDirs Include="$(RefPath)" />
<DefaultReferenceItems Include="%(DefaultReferenceDirs.Identity)/*.dll" />
<DefaultReferenceExclusions>
<RefDir>%(DefaultReferenceDirs.Identity)</RefDir>
</DefaultReferenceExclusions>
<_defaultReferenceExclusionsFullPath Include="%(DefaultReferenceExclusions.RefDir)%(DefaultReferenceExclusions.Identity).dll" />
<!-- Ensure conflict resolution can see these references. -->
<Reference Include="%(DefaultReferenceItems.FullPath)" Private="false" />
</ItemGroup>
</Target>
<Target Name="RemoveConflictResolutionAssetsForTests"
AfterTargets="_HandlePackageFileConflicts"
DependsOnTargets="AddDefaultTestReferences"
Condition="'@(_defaultReferenceExclusionsFullPath)' != ''">
<ItemGroup>
<Reference Remove="@(_defaultReferenceExclusionsFullPath)" />
</ItemGroup>
</Target>
<Target Name="AddReferencesDynamically" BeforeTargets="PrepareForBuild" />
</Project>