forked from dotnet/wcf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFacadeAssemblies.targets
64 lines (54 loc) · 3.62 KB
/
FacadeAssemblies.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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--Don't produce or publish symbols for Facade assemblies.-->
<PublishWindowsPdb>false</PublishWindowsPdb>
<!-- GenFacades requires a PDB -->
<DebugType>portable</DebugType>
<NoWarn Condition="'$(IsReferenceAssembly)' == 'true'">$(NoWarn);0436</NoWarn>
<HasReferenceAssembly Condition="'$(IsReferenceAssembly)' != 'true' AND Exists('..\ref\$(AssemblyName).Ref.csproj')">true</HasReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.GenFacades" Version="$(MicrosoftDotNetGenFacadesPackageVersion)" PrivateAssets="All" />
<ContractProjectReference Include="..\ref\$(AssemblyName).Ref.csproj"
Condition="'@(ContractProjectReference)' == '' AND '$(HasReferenceAssembly)' == 'true'" />
</ItemGroup>
<Target Condition="'@(ContractProjectReference)' == ''" Name="EnsureContractProjectReference" >
<!-- If no ContractProjectReference was specified, use a compatible TargetFramework from this project -->
<ItemGroup>
<!-- Exclude the current TargetFramework to find the next closest TargetFramework-->
<_OtherTargetFrameworks Include="$(TargetFrameworks)" Exclude="$(TargetFramework)" />
<_SelfProjectReference Include="$(MSBuildProjectFile)" TargetFrameworks="@(_OtherTargetFrameworks)" />
</ItemGroup>
<!-- Find the next closest reference -->
<GetReferenceNearestTargetFrameworkTask AnnotatedProjectReferences="@(_SelfProjectReference)"
CurrentProjectTargetFramework="$(TargetFramework)"
CurrentProjectTargetPlatform="$(TargetPlatformMoniker)"
CurrentProjectName="$(MSBuildProjectName)"
FallbackTargetFrameworks="$(AssetTargetFallback)">
<Output ItemName="_AnnotatedSelfProjectReference" TaskParameter="AssignedProjects" />
</GetReferenceNearestTargetFrameworkTask>
<Error Text="Cannot locate a compatible reference from '@(_OtherTargetFrameworks)' for TargetFramework '$(TargetFramework)'. Cannot generate a facade without a reference as input."
Condition="'%(_AnnotatedSelfProjectReference.NearestTargetFramework)' == ''" />
<ItemGroup>
<ContractProjectReference Include="@(_AnnotatedSelfProjectReference)" SetTargetFramework="TargetFramework=%(_AnnotatedSelfProjectReference.NearestTargetFramework)" />
</ItemGroup>
</Target>
<!-- Reference ContractProjectReference as the contract for facade generation, if no contract has been provided.-->
<Target Condition="'@(ResolvedMatchingContract)' == ''" Name="ResolveMatchingContract" AfterTargets="ResolvePackageDependenciesForBuild" DependsOnTargets="EnsureContractProjectReference">
<ItemGroup>
<ProjectReference Include="@(ContractProjectReference)">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>ResolvedMatchingContract</OutputItemType>
</ProjectReference>
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(HasReferenceAssembly)' == 'true'">
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificBuildOutput);AddReferenceAssemblyToPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<Target Name="AddReferenceAssemblyToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<TfmSpecificPackageFile Include="@(ResolvedMatchingContract)" PackagePath="ref/$(TargetFramework)" />
</ItemGroup>
</Target>
</Project>