xamarin-macios/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.Implicit...

106 строки
5.4 KiB
XML

<!--
***********************************************************************************************
Xamarin.Mac.Common.ImplicitFacade.msbuild.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file imports the version- and platform-specific targets for the project importing
this file. This file also defines targets to produce an error if the specified targets
file does not exist, but the project is built anyway (command-line or IDE build).
Copyright (c) 2017 Microsoft Corp. (www.microsoft.com)
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- All of this logic copied directly from Microsoft.NETFramework.CurrentVersion.targets -->
<!-- XM Mobile/Modern builds do not import it since their TVI is not NETFramework -->
<!-- However it is needed to successfully consume netstandard nuget packages -->
<PropertyGroup>
<ResolveReferencesDependsOn>
$(ResolveReferencesDependsOn);
ImplicitlyExpandDesignTimeFacades
</ResolveReferencesDependsOn>
<ImplicitlyExpandDesignTimeFacadesDependsOn>
$(ImplicitlyExpandDesignTimeFacadesDependsOn);
GetReferenceAssemblyPaths
</ImplicitlyExpandDesignTimeFacadesDependsOn>
<_NETBuildExtensionsTaskAssembly>$(MSBuildExtensionsPath)\Microsoft\Microsoft.NET.Build.Extensions\tools\net472\Microsoft.NET.Build.Extensions.Tasks.dll</_NETBuildExtensionsTaskAssembly>
</PropertyGroup>
<!-- Implicitly references all portable design-time facades if the user is referencing a System.Runtime-based portable library -->
<UsingTask
TaskName="GetDependsOnNETStandard"
Condition="Exists('$(_NETBuildExtensionsTaskAssembly)')"
AssemblyFile="$(_NETBuildExtensionsTaskAssembly)" />
<Target Name="ImplicitlyExpandDesignTimeFacades" DependsOnTargets="$(ImplicitlyExpandDesignTimeFacadesDependsOn)">
<ItemGroup>
<XM_CandidateNETStandardReferences Include="@(Reference);@(_ResolvedProjectReferencePaths)" />
<XM_InboxNETStandardFolders Include="$(TargetFrameworkDirectory)" />
</ItemGroup>
<PropertyGroup>
<!-- Does one of our dependencies reference a System.Runtime-based portable library? -->
<_HasReferenceToSystemRuntime Condition="'$(DependsOnSystemRuntime)' == 'true' or '%(_ResolvedProjectReferencePaths.TargetPlatformIdentifier)' == 'Portable'">true</_HasReferenceToSystemRuntime>
<XM_NETStandardInbox Condition="'$(XM_NETStandardInbox)' == '' and Exists('%(XM_InboxNETStandardFolders.Identity)\netstandard.dll')">true</XM_NETStandardInbox>
<!--
This is `true` if any of the references depends on `netstandard`.
In cases where `ResolveAssemblyReference` task does get run, it populates `$(_DependsOnNETStandard)` property, so we don't
need to check this again.
-->
<XM_DependsOnNETStandard Condition="'$(XM_DependsOnNETStandard)' == ''">$(_DependsOnNETStandard)</XM_DependsOnNETStandard>
</PropertyGroup>
<!--
Facades are expanded if we have a reference that depends on System.Runtime .
This file is imported for Modern projects, which have have `$(TargetFrameworkIdentifier) != .NETFramework`, so Microsoft.NET.Build.Extensions
(which provides support for ns 2.0 projects) doesn't get imported. And netstandard.dll reference, even if required, doesn't get added.
So, we need to check if any references depend on `netstandard`. And if so, expand the facades, which include netstandard.dll .
If $(_HasReferenceToSystemRuntime) is true, then the facades are going to be expanded anyway, so don't run this.
-->
<GetDependsOnNETStandard
Condition="'$(_HasReferenceToSystemRuntime)' != 'true' and '$(XM_DependsOnNETStandard)' == '' and '@(XM_CandidateNETStandardReferences)' != ''
and Exists('$(_NETBuildExtensionsTaskAssembly)')"
References="@(XM_CandidateNETStandardReferences)">
<Output TaskParameter="DependsOnNETStandard" PropertyName="XM_DependsOnNETStandard" />
</GetDependsOnNETStandard>
<ItemGroup Condition="'$(_HasReferenceToSystemRuntime)' == 'true' or ('$(XM_NETStandardInbox)' == 'true' and '$(XM_DependsOnNETStandard)' == 'true')">
<_DesignTimeFacadeAssemblies Include="%(DesignTimeFacadeDirectories.Identity)*.dll"/>
<_DesignTimeFacadeAssemblies_Names Include="@(_DesignTimeFacadeAssemblies->'%(FileName)')">
<OriginalIdentity>%(_DesignTimeFacadeAssemblies.Identity)</OriginalIdentity>
</_DesignTimeFacadeAssemblies_Names>
<_ReferencePath_Names Include="@(ReferencePath->'%(FileName)')">
<OriginalIdentity>%(ReferencePath.Identity)</OriginalIdentity>
</_ReferencePath_Names>
<_DesignTimeFacadeAssemblies_Names Remove="@(_ReferencePath_Names)"/>
<ReferencePath Include="@(_DesignTimeFacadeAssemblies_Names->'%(OriginalIdentity)')">
<WinMDFile>false</WinMDFile>
<CopyLocal>false</CopyLocal>
<ResolvedFrom>ImplicitlyExpandDesignTimeFacades</ResolvedFrom>
</ReferencePath>
<_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />
</ItemGroup>
<Message Importance="Low" Text="Including @(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />
</Target>
</Project>