Unpack dotnet sdk zipfile and add documentation file to nupkg
[platform/core/dotnet/build-tools.git] / dotnet / sdk / 2.0.0-preview1-005700 / Sdks / Microsoft.NET.Sdk / build / Microsoft.NET.RuntimeIdentifierInference.targets
1 <!--\r
2 ***********************************************************************************************\r
3 Microsoft.NET.RuntimeIdentifierInference.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 ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
13 \r
14   <PropertyGroup>\r
15     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>\r
16   </PropertyGroup>\r
17 \r
18   <!--\r
19     .NETFramework cannot load native package dependencies dynamically\r
20     based on the current architecture.  We have must have a RID to\r
21     resolve and copy native dependencies to the output directory.\r
22 \r
23      When building a .NETFramework exe on Windows and not given a RID,\r
24      we'll pick either win7-x64 or win7-x86 (based on PlatformTarget)\r
25      if we're not given an explicit RID. However, if after resolving\r
26      NuGet assets we find no copy-local native dependencies, we will\r
27      emit the binary as AnyCPU.\r
28 \r
29      Note that we must set the RID here early (to be seen during NuGet\r
30      restore) in order for the project.assets.json to include the\r
31      native dependencies that will let us make the final call on\r
32      AnyCPU or platform-specific.\r
33 \r
34      This allows these common cases to work without requiring mention\r
35      of RuntimeIdentifier in the user project PlatformTarget:\r
36 \r
37       1. Building an AnyCPU .NETFramework application on any host OS\r
38          with no native NuGet dependencies. (*)\r
39 \r
40       2. Building an x86 or x64 NETFramework application on and for\r
41          Windows with native NuGet dependencies that do not require\r
42          greater than win7.\r
43 \r
44      However, any other combination of host operating system, CPU\r
45      architecture, and minimum Windows version will require some\r
46      manual intervention in the project file to set up the right\r
47      RID. (**)\r
48 \r
49      (*) Building NET4x from non-Windows is still not fully supported:\r
50          https://github.com/dotnet/sdk/issues/335) The point above is\r
51          that this code would not have to change to make the first\r
52          scenario work on non-Windows hosts.\r
53 \r
54      (**) https://github.com/dotnet/sdk/issues/840 tracks improving\r
55           the default RID selection here to make more non-AnyCPU scenarios\r
56           work without user intervention. The current static evaluation\r
57           requirement limits us.\r
58    -->\r
59   <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and \r
60                             '$(OutputType)' == 'Exe' and \r
61                             '$(OS)' == 'Windows_NT' and\r
62                             '$(RuntimeIdentifier)' == ''">\r
63     <_UsingDefaultRuntimeIdentifier>true</_UsingDefaultRuntimeIdentifier>\r
64     <RuntimeIdentifier Condition="'$(PlatformTarget)' == 'x64'">win7-x64</RuntimeIdentifier>\r
65     <RuntimeIdentifier Condition="'$(PlatformTarget)' == 'x86' or '$(PlatformTarget)' == ''">win7-x86</RuntimeIdentifier>\r
66   </PropertyGroup>\r
67 \r
68   <PropertyGroup Condition="'$(PlatformTarget)' == ''">\r
69     <_UsingDefaultPlatformTarget>true</_UsingDefaultPlatformTarget>\r
70   </PropertyGroup>\r
71 \r
72   <!-- Determine PlatformTarget (if not already set) from runtime identifier. -->\r
73   <Choose>\r
74     <When Condition="'$(PlatformTarget)' != '' or '$(RuntimeIdentifier)' == ''" />\r
75 \r
76     <When Condition="$(RuntimeIdentifier.EndsWith('-x86')) or $(RuntimeIdentifier.Contains('-x86-'))">\r
77       <PropertyGroup>\r
78         <PlatformTarget>x86</PlatformTarget>\r
79       </PropertyGroup>\r
80     </When>\r
81 \r
82     <When Condition="$(RuntimeIdentifier.EndsWith('-x64')) or $(RuntimeIdentifier.Contains('-x64-'))">\r
83       <PropertyGroup>\r
84         <PlatformTarget>x64</PlatformTarget>\r
85       </PropertyGroup>\r
86     </When>\r
87 \r
88     <When Condition="$(RuntimeIdentifier.EndsWith('-arm')) or $(RuntimeIdentifier.Contains('-arm-'))">\r
89       <PropertyGroup>\r
90         <PlatformTarget>arm</PlatformTarget>\r
91       </PropertyGroup>\r
92     </When>\r
93 \r
94     <!-- NOTE: PlatformTarget=arm64 is not currently supported and therefore no inference of that here. -->\r
95     <Otherwise>\r
96       <PropertyGroup>\r
97         <PlatformTarget>AnyCPU</PlatformTarget>\r
98       </PropertyGroup>\r
99     </Otherwise>\r
100   </Choose>\r
101 \r
102   <PropertyGroup>\r
103     <!-- Projects can opt out of having the RID appended to the output path by setting this to false. -->\r
104     <AppendRuntimeIdentifierToOutputPath Condition="'$(AppendRuntimeIdentifierToOutputPath)' == ''">true</AppendRuntimeIdentifierToOutputPath>\r
105   </PropertyGroup>\r
106 \r
107   <!--\r
108     Append $(RuntimeIdentifier) directory to output and intermediate paths to prevent bin clashes between\r
109     targets. \r
110 \r
111     But do not append the implicit default runtime identifier for .NET Framework apps as that would \r
112     append a RID the user never mentioned in the path and do so even in the AnyCPU case.\r
113    -->\r
114   <PropertyGroup Condition="'$(AppendRuntimeIdentifierToOutputPath)' == 'true' and '$(RuntimeIdentifier)' != '' and '$(_UsingDefaultRuntimeIdentifier)' != 'true'">\r
115     <IntermediateOutputPath>$(IntermediateOutputPath)$(RuntimeIdentifier)\</IntermediateOutputPath>\r
116     <OutputPath>$(OutputPath)$(RuntimeIdentifier)\</OutputPath>\r
117   </PropertyGroup>\r
118 \r
119   <!-- \r
120     Switch our default .NETFramework CPU architecture choice back to AnyCPU before \r
121     compiling the exe if no copy-local native dependencies were resolved from NuGet \r
122   -->\r
123   <Target Name="AdjustDefaultPlatformTargetForNetFrameworkExeWithNoNativeCopyLocalItems"\r
124           AfterTargets="ResolvePackageDependenciesForBuild"\r
125           BeforeTargets="CoreCompile"\r
126           Condition="'$(_UsingDefaultPlatformTarget)' == 'true' and\r
127                      '$(_UsingDefaultRuntimeIdentifier)' == 'true' and \r
128                      '@(NativeCopyLocalItems)' == ''">\r
129     <PropertyGroup>\r
130       <PlatformTarget>AnyCPU</PlatformTarget>\r
131     </PropertyGroup>\r
132   </Target>\r
133 \r
134 </Project>\r