a32df7c42015de3ea979702010fae0e5788a3524
[platform/core/dotnet/build-tools.git] /
1 <!--\r
2 ***********************************************************************************************\r
3 Microsoft.NET.Build.Extensions.NETFramework.targets\r
4 \r
5 WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have\r
6           created a backup copy.  Incorrect changes to this file will make it\r
7           impossible to load or build your projects from the command-line or the IDE.\r
8 \r
9 Copyright (c) .NET Foundation. All rights reserved. \r
10 ***********************************************************************************************\r
11 -->\r
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
13 \r
14   <PropertyGroup>\r
15     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>\r
16 \r
17     <!-- Add NETStandard references if targetframeworkversion supports netstandard2.0 (net461 or later) -->\r
18     <ImplicitlyExpandNETStandardFacades Condition="'$(ImplicitlyExpandNETStandardFacades)' == '' AND '$(_TargetFrameworkVersionWithoutV)' &gt;= '4.6.1'">true</ImplicitlyExpandNETStandardFacades>\r
19   </PropertyGroup>\r
20 \r
21   <UsingTask TaskName="GetDependsOnNETStandard" AssemblyFile="$(MicrosoftNETBuildExtensionsTasksAssembly)" />\r
22   <UsingTask TaskName="NETBuildExtensionsError" AssemblyFile="$(MicrosoftNETBuildExtensionsTasksAssembly)" />\r
23   <Target Name="ImplicitlyExpandNETStandardFacades"\r
24           Condition="'$(ImplicitlyExpandNETStandardFacades)' == 'true'"\r
25           BeforeTargets="_HandlePackageFileConflicts;ResolveAssemblyReferences">\r
26 \r
27     <ItemGroup>\r
28       <_CandidateNETStandardReferences Include="@(Reference);@(_ResolvedProjectReferencePaths)" />\r
29       <_InboxNETStandardFolders Include="$(TargetFrameworkDirectory)" />\r
30     </ItemGroup>\r
31 \r
32     <!-- determine if NETStandard.dll is supported inbox for this TargetFramework -->\r
33     <PropertyGroup Condition="'$(NETStandardInbox)' == ''">\r
34       <NETStandardInbox Condition="Exists('%(_InboxNETStandardFolders.Identity)\netstandard.dll')">true</NETStandardInbox>\r
35     </PropertyGroup>\r
36 \r
37     <!-- determine if any references depend on NETStandard -->\r
38     <GetDependsOnNETStandard Condition="'$(DependsOnNETStandard)' == '' AND '$(NETStandardInbox)' != 'true' AND '@(_CandidateNETStandardReferences)' != ''" \r
39                              References="@(_CandidateNETStandardReferences)">\r
40       <Output TaskParameter="DependsOnNETStandard" PropertyName="DependsOnNETStandard" />\r
41     </GetDependsOnNETStandard>\r
42 \r
43     <!-- prevent using an older SDK version with NETStandard2.0 references -->\r
44     <PropertyGroup>\r
45       <_UsingOldSDK Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND ('$(TargetFramework)' != '' OR '$(TargetFrameworks)' != '')">true</_UsingOldSDK>\r
46     </PropertyGroup>\r
47     <NETBuildExtensionsError Condition="'$(DependsOnNETStandard)' == 'true' AND '$(NETStandardInbox)' != 'true' AND '$(_UsingOldSDK)' == 'true'"\r
48                              ResourceName="UnsupportedSDKVersionForNetStandard20"/>\r
49     \r
50     <!-- if any reference depends on netstandard and it is not inbox, add references and implementation assemblies for netstandard2.0  -->\r
51     <ItemGroup Condition="'$(DependsOnNETStandard)' == 'true' AND '$(NETStandardInbox)' != 'true'">\r
52       <_NETStandardLibraryNETFrameworkReference Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.7'"\r
53                                                 Include="$(MSBuildThisFileDirectory)\net47\ref\*.dll" />\r
54       <_NETStandardLibraryNETFrameworkReference Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.6.2'"\r
55                                                 Include="$(MSBuildThisFileDirectory)\net462\ref\*.dll"\r
56                                                 Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\net462\ref\%(FileName).dll')" />\r
57       <_NETStandardLibraryNETFrameworkReference Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.6.1'"\r
58                                                 Include="$(MSBuildThisFileDirectory)\net461\ref\*.dll"\r
59                                                 Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\net461\ref\%(FileName).dll')" />\r
60 \r
61       <_NETStandardLibraryNETFrameworkLib Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.7'"\r
62                                           Include="$(MSBuildThisFileDirectory)\net47\lib\*.dll" />\r
63       <_NETStandardLibraryNETFrameworkLib Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.6.2'"\r
64                                           Include="$(MSBuildThisFileDirectory)\net462\lib\*.dll"\r
65                                           Exclude="@(_NETStandardLibraryNETFrameworkLib->'$(MSBuildThisFileDirectory)\net462\lib\%(FileName).dll')" />\r
66       <_NETStandardLibraryNETFrameworkLib Condition="'$(_TargetFrameworkVersionWithoutV)' &gt;= '4.6.1'"\r
67                                           Include="$(MSBuildThisFileDirectory)\net461\lib\*.dll"\r
68                                           Exclude="@(_NETStandardLibraryNETFrameworkLib->'$(MSBuildThisFileDirectory)\net461\lib\%(FileName).dll')" />\r
69 \r
70       <!-- Remove simple name references if we're directly providing a reference assembly to the compiler. For example,\r
71            consider a project with a Reference Include="System.Net.Http" or "System.IO.Compression", which are both in \r
72            _NETStandardLibraryNETFrameworkReference.\r
73            Simple references can also come from NuGet framework assemblies, hence this statement should occur after\r
74            including all computed references, thus this target is scheduled after references have been raised by NuGet\r
75            targets. -->\r
76       <Reference Remove="%(_NETStandardLibraryNETFrameworkReference.FileName)" />\r
77 \r
78       <Reference Include="@(_NETStandardLibraryNETFrameworkReference)">\r
79         <Private>false</Private>\r
80       </Reference>\r
81 \r
82       <ReferenceCopyLocalPaths Include="@(_NETStandardLibraryNETFrameworkLib)">\r
83         <Private>false</Private>\r
84       </ReferenceCopyLocalPaths>\r
85     </ItemGroup>\r
86   </Target>\r
87 </Project>\r