[Tizen] separate PIC and PIE to fix x86_64 build error
[platform/upstream/dotnet/runtime.git] / Directory.Build.props
1 <Project>
2   <PropertyGroup>
3     <!-- For non-SDK projects that import this file and then import Microsoft.Common.props,
4          tell Microsoft.Common.props not to import Directory.Build.props again. -->
5     <ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
6     <!-- Used to determine if we should build some packages only once across multiple official build legs.
7          For offline builds we still set OfficialBuildId but we need to build all the packages for a single
8          leg only, so we also take DotNetBuildFromSource  into account. -->
9     <BuildingAnOfficialBuildLeg Condition="'$(BuildingAnOfficialBuildLeg)' == '' and '$(OfficialBuildId)' != '' and '$(DotNetBuildFromSource)' != 'true'">true</BuildingAnOfficialBuildLeg>
10     <!-- When doing a source build, we want to build the various text-only manifests in
11          all cases, rather than ordinarily where we build them during mobile or wasm
12          build legs. This makes the manifests available on source-only builds. -->
13     <ForceBuildMobileManifests Condition="'$(DotNetBuildFromSource)' == 'true'">true</ForceBuildMobileManifests>
14   </PropertyGroup>
15
16   <PropertyGroup Label="CalculateTargetOS">
17     <_hostOS>linux</_hostOS>
18     <_hostOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx</_hostOS>
19     <_hostOS Condition="$([MSBuild]::IsOSPlatform('FREEBSD'))">freebsd</_hostOS>
20     <_hostOS Condition="$([MSBuild]::IsOSPlatform('NETBSD'))">netbsd</_hostOS>
21     <_hostOS Condition="$([MSBuild]::IsOSPlatform('ILLUMOS'))">illumos</_hostOS>
22     <_hostOS Condition="$([MSBuild]::IsOSPlatform('SOLARIS'))">solaris</_hostOS>
23     <_hostOS Condition="$([MSBuild]::IsOSPlatform('HAIKU'))">haiku</_hostOS>
24     <_hostOS Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">windows</_hostOS>
25     <HostOS>$(_hostOS)</HostOS>
26     <TargetOS Condition="'$(TargetOS)' == '' and '$(RuntimeIdentifier)' == 'browser-wasm'">browser</TargetOS>
27     <TargetOS Condition="'$(TargetOS)' == ''">$(_hostOS)</TargetOS>
28     <TargetsMobile Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'android' or '$(TargetOS)' == 'browser' or '$(TargetOS)' == 'wasi'">true</TargetsMobile>
29     <TargetsAppleMobile Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator'">true</TargetsAppleMobile>
30   </PropertyGroup>
31
32   <!-- Platform property is required by RepoLayout.props in Arcade SDK. -->
33   <PropertyGroup Label="CalculateArch">
34     <_hostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant)</_hostArch>
35     <BuildArchitecture Condition="'$(BuildArchitecture)' == ''">$(_hostArch)</BuildArchitecture>
36     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and ('$(TargetOS)' == 'browser' or '$(RuntimeIdentifier)' == 'browser-wasm')">wasm</TargetArchitecture>
37     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and ('$(TargetOS)' == 'wasi' or '$(RuntimeIdentifier)' == 'wasi-wasm')">wasm</TargetArchitecture>
38     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'arm'">arm</TargetArchitecture>
39     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'armv6'">armv6</TargetArchitecture>
40     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'armel'">armel</TargetArchitecture>
41     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'arm64'">arm64</TargetArchitecture>
42     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'loongarch64'">loongarch64</TargetArchitecture>
43     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 's390x'">s390x</TargetArchitecture>
44     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'ppc64le'">ppc64le</TargetArchitecture>
45     <TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(TargetsMobile)' == 'true'">x64</TargetArchitecture>
46     <TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
47     <Platform Condition="'$(Platform)' == '' and '$(InferPlatformFromTargetArchitecture)' == 'true'">$(TargetArchitecture)</Platform>
48   </PropertyGroup>
49
50   <PropertyGroup Label="SetOSTargetMinVersions">
51     <!--
52       Minimum target OS versions, keep in sync with:
53         - eng/native/configurecompiler.cmake
54         - eng/native/build-commons.sh
55         - src/native/libs/build-native.sh
56         - src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs
57         - src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
58         - src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml
59         - src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml
60         - src/tasks/MobileBuildTasks/Apple/AppleProject.cs
61      -->
62     <AndroidApiLevelMin>21</AndroidApiLevelMin>
63     <iOSVersionMin>11.0</iOSVersionMin>
64     <tvOSVersionMin>11.0</tvOSVersionMin>
65     <watchOSVersionMin>2.0</watchOSVersionMin>
66     <watchOS64_32VersionMin>5.1</watchOS64_32VersionMin>
67     <macOSVersionMin>10.15</macOSVersionMin>
68     <macOSVersionMin Condition="('$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst') and '$(TargetArchitecture)' == 'arm64'">11.0</macOSVersionMin>
69   </PropertyGroup>
70
71   <PropertyGroup>
72     <!-- Set OutDirName (Arcade specific property that must be set before the Arcade SDK is imported) to change the BaseOutputPath and
73          BaseIntermediateOutputPath properties to include the ref subfolder. -->
74     <IsReferenceAssemblyProject Condition="$([System.IO.Path]::GetFileName('$(MSBuildProjectDirectory)')) == 'ref'">true</IsReferenceAssemblyProject>
75     <OutDirName Condition="'$(IsReferenceAssemblyProject)' == 'true'">$(MSBuildProjectName)$([System.IO.Path]::DirectorySeparatorChar)ref</OutDirName>
76   </PropertyGroup>
77
78   <!-- Import the Arcade SDK -->
79   <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
80
81   <!-- The TFMs to build and test against. -->
82   <PropertyGroup>
83     <NetCoreAppCurrentVersion>8.0</NetCoreAppCurrentVersion>
84     <NetCoreAppCurrentIdentifier>.NETCoreApp</NetCoreAppCurrentIdentifier>
85     <NetCoreAppCurrentTargetFrameworkMoniker>$(NetCoreAppCurrentIdentifier),Version=v$(NetCoreAppCurrentVersion)</NetCoreAppCurrentTargetFrameworkMoniker>
86     <MicrosoftNetCoreAppFrameworkName>Microsoft.NETCore.App</MicrosoftNetCoreAppFrameworkName>
87     <NetCoreAppCurrentBrandName>.NET $(NetCoreAppCurrentVersion)</NetCoreAppCurrentBrandName>
88     <NetCoreAppCurrent>net$(NetCoreAppCurrentVersion)</NetCoreAppCurrent>
89
90     <!-- The previous supported .NET version. -->
91     <NetCoreAppPreviousVersion>7.0</NetCoreAppPreviousVersion>
92     <NetCoreAppPrevious>net$(NetCoreAppPreviousVersion)</NetCoreAppPrevious>
93     <NetCoreAppPrevious Condition="'$(DotNetBuildFromSource)' == 'true'">$(NetCoreAppCurrent)</NetCoreAppPrevious>
94
95     <!-- The minimum supported .NET version. -->
96     <NetCoreAppMinimum>net6.0</NetCoreAppMinimum>
97     <NetCoreAppMinimum Condition="'$(DotNetBuildFromSource)' == 'true'">$(NetCoreAppCurrent)</NetCoreAppMinimum>
98
99     <!-- when this is updated, make sure to keep $(_TargetFrameworkForNETCoreTasks)
100          in src/mono/wasm/build/WasmApp.LocalBuild.props in sync -->
101     <NetCoreAppToolCurrentVersion>8.0</NetCoreAppToolCurrentVersion>
102     <NetCoreAppToolCurrent>net$(NetCoreAppToolCurrentVersion)</NetCoreAppToolCurrent>
103     <NetCoreAppCurrentToolTargetFrameworkMoniker>$(NetCoreAppCurrentIdentifier),Version=v$(NetCoreAppToolCurrentVersion)</NetCoreAppCurrentToolTargetFrameworkMoniker>
104
105     <AspNetCoreAppCurrentVersion>8.0</AspNetCoreAppCurrentVersion>
106     <AspNetCoreAppCurrent>net$(AspNetCoreAppCurrentVersion)</AspNetCoreAppCurrent>
107
108     <NetFrameworkMinimum>net462</NetFrameworkMinimum>
109     <NetFrameworkCurrent>net48</NetFrameworkCurrent>
110     <NetFrameworkToolCurrent>net472</NetFrameworkToolCurrent>
111     <!-- Don't build for NETFramework during source-build. -->
112     <NetFrameworkMinimum Condition="'$(DotNetBuildFromSource)' == 'true'" />
113     <NetFrameworkToolCurrent Condition="'$(DotNetBuildFromSource)' == 'true'" />
114     <NetFrameworkCurrent Condition="'$(DotNetBuildFromSource)' == 'true'" />
115
116     <!-- Important: Set this to the GA version (or a close approximation) during servicing and adjust the TFM property below. -->
117     <ApiCompatNetCoreAppBaselineVersion>7.0.0</ApiCompatNetCoreAppBaselineVersion>
118     <ApiCompatNetCoreAppBaselineTFM>net7.0</ApiCompatNetCoreAppBaselineTFM>
119
120     <TargetFrameworkForNETFrameworkTasks>$(NetFrameworkToolCurrent)</TargetFrameworkForNETFrameworkTasks>
121     <!-- Don't build for NETFramework during source-build. -->
122     <TargetFrameworkForNETFrameworkTasks Condition="'$(DotNetBuildFromSource)' == 'true'" />
123
124     <TargetFrameworkForNETCoreTasks>$(NetCoreAppToolCurrent)</TargetFrameworkForNETCoreTasks>
125   </PropertyGroup>
126
127   <PropertyGroup Label="CalculateConfiguration">
128     <!-- The RuntimeConfiguration property allows to pass in/specify a configuration that applies to both CoreCLR and Mono. -->
129     <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">$(Configuration)</RuntimeConfiguration>
130     <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == '' and ('$(Configuration)' == 'Debug' or '$(Configuration)' == 'Release')">$(Configuration)</RuntimeConfiguration>
131     <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">Debug</RuntimeConfiguration>
132     <CoreCLRConfiguration Condition="'$(CoreCLRConfiguration)' == ''">$(RuntimeConfiguration)</CoreCLRConfiguration>
133     <MonoConfiguration Condition="'$(MonoConfiguration)' == '' and '$(RuntimeConfiguration.ToLower())' != 'checked'">$(RuntimeConfiguration)</MonoConfiguration>
134     <!-- There's no checked configuration on Mono. -->
135     <MonoConfiguration Condition="'$(MonoConfiguration)' == '' and '$(RuntimeConfiguration.ToLower())' == 'checked'">Debug</MonoConfiguration>
136     <LibrariesConfiguration Condition="'$(LibrariesConfiguration)' == ''">$(Configuration)</LibrariesConfiguration>
137     <HostConfiguration Condition="'$(HostConfiguration)' == ''">$(Configuration)</HostConfiguration>
138     <TasksConfiguration Condition="'$(TasksConfiguration)' == ''">$(Configuration)</TasksConfiguration>
139   </PropertyGroup>
140
141   <PropertyGroup>
142     <LibrariesProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'libraries'))</LibrariesProjectRoot>
143     <CoreClrProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'coreclr'))</CoreClrProjectRoot>
144     <MonoProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'mono'))</MonoProjectRoot>
145     <InstallerProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'installer'))</InstallerProjectRoot>
146     <WorkloadsProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'workloads'))</WorkloadsProjectRoot>
147     <ToolsProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'tools'))</ToolsProjectRoot>
148     <SharedNativeRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'native'))</SharedNativeRoot>
149     <RepoTasksDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'tasks'))</RepoTasksDir>
150     <IbcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc'))</IbcOptimizationDataDir>
151     <MibcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'mibc'))</MibcOptimizationDataDir>
152     <DocsDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'docs'))</DocsDir>
153
154     <AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</AppleAppBuilderDir>
155     <AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'publish'))</AndroidAppBuilderDir>
156     <MobileBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MobileBuildTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</MobileBuildTasksDir>
157     <WasmAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</WasmAppBuilderDir>
158     <WasmBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'publish'))</WasmBuildTasksDir>
159     <WorkloadBuildTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WorkloadBuildTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</WorkloadBuildTasksDir>
160     <LibraryBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'LibraryBuilder', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</LibraryBuilderDir>
161     <MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
162     <MonoTargetsTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoTargetsTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</MonoTargetsTasksDir>
163     <TestExclusionListTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'TestExclusionListTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</TestExclusionListTasksDir>
164     <InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
165     <InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', '$(TasksConfiguration)', '$(NetFrameworkToolCurrent)', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
166     <Crossgen2SdkOverridePropsPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Crossgen2Tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'Microsoft.NET.CrossGen.props'))</Crossgen2SdkOverridePropsPath>
167     <Crossgen2SdkOverrideTargetsPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Crossgen2Tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'Microsoft.NET.CrossGen.targets'))</Crossgen2SdkOverrideTargetsPath>
168     <AppleAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AppleAppBuilderDir)', 'AppleAppBuilder.dll'))</AppleAppBuilderTasksAssemblyPath>
169     <AndroidAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AndroidAppBuilderDir)', 'AndroidAppBuilder.dll'))</AndroidAppBuilderTasksAssemblyPath>
170     <MobileBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MobileBuildTasksDir)', 'MobileBuildTasks.dll'))</MobileBuildTasksAssemblyPath>
171     <WasmAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))</WasmAppBuilderTasksAssemblyPath>
172     <WasmBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WasmBuildTasksDir)', 'WasmBuildTasks.dll'))</WasmBuildTasksAssemblyPath>
173     <WasmAppHostDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppHost', 'wasm', '$(Configuration)'))</WasmAppHostDir>
174     <WorkloadBuildTasksAssemblyPath>$([MSBuild]::NormalizePath('$(WorkloadBuildTasksDir)', 'WorkloadBuildTasks.dll'))</WorkloadBuildTasksAssemblyPath>
175     <LibraryBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(LibraryBuilderDir)', 'LibraryBuilder.dll'))</LibraryBuilderTasksAssemblyPath>
176     <MonoAOTCompilerTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))</MonoAOTCompilerTasksAssemblyPath>
177     <MonoTargetsTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoTargetsTasksDir)', 'MonoTargetsTasks.dll'))</MonoTargetsTasksAssemblyPath>
178     <TestExclusionListTasksAssemblyPath>$([MSBuild]::NormalizePath('$(TestExclusionListTasksDir)', 'TestExclusionListTasks.dll'))</TestExclusionListTasksAssemblyPath>
179     <CoreCLRToolPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)'))</CoreCLRToolPath>
180     <ILAsmToolPath Condition="'$(DotNetBuildFromSource)' == 'true' or '$(BuildArchitecture)' == 's390x' or '$(BuildArchitecture)' == 'ppc64le'">$(CoreCLRToolPath)</ILAsmToolPath>
181
182     <WasmtimeDir Condition="'$(WasmtimeDir)' == '' and '$(WASMTIME_PATH)' != '' and Exists($(WASMTIME_PATH))">$(WASMTIME_PATH)</WasmtimeDir>
183     <WasmtimeDir Condition="'$(WasmtimeDir)' == ''">$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))</WasmtimeDir>
184     <InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
185   </PropertyGroup>
186
187   <PropertyGroup Label="CalculatePortableBuild">
188     <PortableBuild Condition="'$(PortableBuild)' == '' and '$(DotNetBuildFromSource)' == 'true'">false</PortableBuild>
189     <PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
190   </PropertyGroup>
191
192   <!-- _portableOS is the portable rid-OS corresponding to the target platform. -->
193   <PropertyGroup Label="CalculatePortableOS">
194     <!-- To determine _portableOS we use TargetOS.
195          TargetOS is not a rid-OS. For example: for Windows it is 'windows' instead of 'win'.
196          And, for flavors of Linux, like 'linux-musl' and 'linux-bionic', TargetOS is 'linux'. -->
197
198     <_portableOS>$(TargetOS.ToLowerInvariant())</_portableOS>
199     <_portableOS Condition="'$(_portableOS)' == 'windows'">win</_portableOS>
200
201     <!-- TargetOS=AnyOS is a sentinel value used by tests, ignore it.  -->
202     <_portableOS Condition="'$(_portableOS)' == 'anyos'">$(__PortableTargetOS)</_portableOS>
203
204     <!-- Detect linux flavors using __PortableTargetOS from the native script. -->
205     <_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-musl'">linux-musl</_portableOS>
206     <_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-bionic'">linux-bionic</_portableOS>
207
208     <!-- On Windows, we can build for Windows and Mobile.
209          For other TargetOSes, create a "win" build, built from TargetOS sources and "win" pre-built packages. -->
210     <_portableOS Condition="'$(HostOS)' == 'win' and '$(TargetsMobile)' != 'true'">win</_portableOS>
211   </PropertyGroup>
212
213   <!-- PackageRID is used for packages needed for the target. -->
214   <PropertyGroup Label="CalculatePackageRID">
215     <_packageOS>$(_portableOS)</_packageOS>
216
217     <_packageOS Condition="'$(CrossBuild)' == 'true' and '$(_portableOS)' != 'linux-musl' and '$(_portableOS)' != 'linux-bionic'">$(_hostOS)</_packageOS>
218
219     <!-- source-build sets PackageOS to build with non-portable rid packages that were source-built previously. -->
220     <PackageRID Condition="'$(PackageOS)' != ''">$(PackageOS)-$(TargetArchitecture)</PackageRID>
221     <PackageRID Condition="'$(PackageRID)' == ''">$(_packageOS)-$(TargetArchitecture)</PackageRID>
222   </PropertyGroup>
223
224   <!-- ToolsRID is used for packages needed on the build host. -->
225   <PropertyGroup Label="CalculateToolsRID">
226     <!-- _portableHostOS is the portable rid-OS corresponding to the build host platform.
227
228          To determine _portableHostOS we use _hostOS, similar to how _portableOS is calculated from TargetOS.
229
230          When we're not cross-building we can detect linux flavors by looking at _portableOS
231          because the target platform and the build host platform are the same.
232          For cross-builds, we're currently unable to detect the flavors. -->
233     <_portableHostOS>$(_hostOS)</_portableHostOS>
234     <_portableHostOS Condition="'$(_portableHostOS)' == 'windows'">win</_portableHostOS>
235     <_portableHostOS Condition="'$(CrossBuild)' != 'true' and '$(_portableOS)' == 'linux-musl'">linux-musl</_portableHostOS>
236
237     <!-- source-build sets ToolsOS to build with non-portable rid packages that were source-built previously. -->
238     <ToolsRID Condition="'$(ToolsOS)' != ''">$(ToolsOS)-$(_hostArch)</ToolsRID>
239     <ToolsRID Condition="'$(ToolsRID)' == ''">$(_portableHostOS)-$(_hostArch)</ToolsRID>
240
241     <!-- Microsoft.NET.Sdk.IL SDK defaults to the portable host rid. Match it to ToolsRID (for source-build). -->
242     <MicrosoftNetCoreIlasmPackageRuntimeId>$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
243   </PropertyGroup>
244
245   <!-- OutputRID is used to name the target platform.
246        For portable builds, OutputRID matches _portableOS.
247        For non-portable builds, it uses __DistroRid (from the native build script), or falls back to RuntimeInformation.RuntimeIdentifier.
248        Source-build sets OutputRID directly. -->
249   <PropertyGroup Label="CalculateOutputRID">
250     <_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid>
251     <_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid>
252
253     <_parseDistroRid>$(__DistroRid)</_parseDistroRid>
254     <_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid>
255     <_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>
256
257     <_outputOS>$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_outputOS>
258     <_outputOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_outputOS>
259
260     <OutputRID Condition="'$(OutputRID)' == ''">$(_outputOS)-$(TargetArchitecture)</OutputRID>
261   </PropertyGroup>
262
263   <PropertyGroup Label="CalculateTargetOSName">
264     <TargetsFreeBSD Condition="'$(TargetOS)' == 'freebsd'">true</TargetsFreeBSD>
265     <Targetsillumos Condition="'$(TargetOS)' == 'illumos'">true</Targetsillumos>
266     <TargetsSolaris Condition="'$(TargetOS)' == 'solaris'">true</TargetsSolaris>
267     <TargetsHaiku Condition="'$(TargetOS)' == 'haiku'">true</TargetsHaiku>
268     <TargetsLinux Condition="'$(TargetOS)' == 'linux' or '$(TargetOS)' == 'android'">true</TargetsLinux>
269     <TargetsLinuxBionic Condition="'$(_portableOS)' == 'linux-bionic'">true</TargetsLinuxBionic>
270     <TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl>
271     <TargetsNetBSD Condition="'$(TargetOS)' == 'netbsd'">true</TargetsNetBSD>
272     <TargetsOSX Condition="'$(TargetOS)' == 'osx'">true</TargetsOSX>
273     <TargetsMacCatalyst Condition="'$(TargetOS)' == 'maccatalyst'">true</TargetsMacCatalyst>
274     <TargetsiOS Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator'">true</TargetsiOS>
275     <TargetstvOS Condition="'$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator'">true</TargetstvOS>
276     <TargetsiOSSimulator Condition="'$(TargetOS)' == 'iossimulator'">true</TargetsiOSSimulator>
277     <TargetstvOSSimulator Condition="'$(TargetOS)' == 'tvossimulator'">true</TargetstvOSSimulator>
278     <TargetsAndroid Condition="'$(TargetOS)' == 'android'">true</TargetsAndroid>
279     <TargetsBrowser Condition="'$(TargetOS)' == 'browser'">true</TargetsBrowser>
280     <TargetsWasi Condition="'$(TargetOS)' == 'wasi'">true</TargetsWasi>
281     <TargetsWindows Condition="'$(TargetOS)' == 'windows'">true</TargetsWindows>
282     <TargetsUnix Condition="'$(TargetsFreeBSD)' == 'true' or '$(Targetsillumos)' == 'true' or '$(TargetsSolaris)' == 'true' or '$(TargetsHaiku)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsNetBSD)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsAndroid)' == 'true'">true</TargetsUnix>
283   </PropertyGroup>
284
285   <PropertyGroup>
286     <MicrosoftNetCoreAppRefPackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.ref'))</MicrosoftNetCoreAppRefPackDir>
287     <MicrosoftNetCoreAppRefPackRefDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'ref', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRefPackRefDir>
288     <MicrosoftNetCoreAppRefPackDataDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'data'))</MicrosoftNetCoreAppRefPackDataDir>
289
290     <MicrosoftNetCoreAppRuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.$(OutputRID)', '$(LibrariesConfiguration)'))</MicrosoftNetCoreAppRuntimePackDir>
291     <MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackDir)', 'runtimes', '$(OutputRID)'))</MicrosoftNetCoreAppRuntimePackRidDir>
292     <MicrosoftNetCoreAppRuntimePackRidLibTfmDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'lib', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRuntimePackRidLibTfmDir>
293     <MicrosoftNetCoreAppRuntimePackNativeDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'native'))</MicrosoftNetCoreAppRuntimePackNativeDir>
294   </PropertyGroup>
295
296   <PropertyGroup>
297     <DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRID).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir>
298   </PropertyGroup>
299
300   <!--Feature switches -->
301   <PropertyGroup>
302     <NoPgoOptimize Condition="'$(NoPgoOptimize)' == '' and '$(DotNetBuildFromSource)' == 'true'">true</NoPgoOptimize>
303     <EnableNgenOptimization Condition="'$(EnableNgenOptimization)' == '' and '$(DotNetBuildFromSource)' == 'true'">false</EnableNgenOptimization>
304     <EnableNgenOptimization Condition="'$(EnableNgenOptimization)' == '' and ('$(Configuration)' == 'Release' or '$(Configuration)' == 'Checked')">true</EnableNgenOptimization>
305     <!-- Enable NuGet static graph evaluation to optimize incremental restore -->
306     <RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
307     <!-- Turn off end of life target framework checks as we intentionally build older .NETCoreApp configurations. -->
308     <CheckEolTargetFramework>false</CheckEolTargetFramework>
309     <!-- Turn off workload support until we support them. -->
310     <MSBuildEnableWorkloadResolver>false</MSBuildEnableWorkloadResolver>
311     <!-- Disable source link when building locally. -->
312     <DisableSourceLink Condition="'$(DisableSourceLink)' == '' and
313                                   '$(ContinuousIntegrationBuild)' != 'true' and
314                                   '$(OfficialBuildId)' == ''">true</DisableSourceLink>
315     <!-- Runtime doesn't support Arcade-driven target framework filtering. -->
316     <NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
317   </PropertyGroup>
318
319   <!-- RepositoryEngineeringDir isn't set when Installer tests import this file. -->
320   <Import Project="$(RepositoryEngineeringDir)native\naming.props" />
321   <Import Project="$(RepositoryEngineeringDir)Subsets.props" />
322
323   <PropertyGroup>
324     <CoreLibSharedDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src'))</CoreLibSharedDir>
325     <CoreLibRefDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'ref'))</CoreLibRefDir>
326     <CoreLibProject Condition="'$(RuntimeFlavor)' == 'CoreCLR'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
327     <CoreLibProject Condition="'$(RuntimeFlavor)' == 'Mono'">$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
328     <CoreLibProject Condition="'$(UseNativeAotCoreLib)' == 'true'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'nativeaot', 'System.Private.CoreLib', 'src', 'System.Private.CoreLib.csproj'))</CoreLibProject>
329     <UriProject>$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Private.Uri', 'src', 'System.Private.Uri.csproj'))</UriProject>
330
331     <!-- this property is used by the SDK to pull in mono-based runtime packs -->
332     <UseMonoRuntime Condition="'$(UseMonoRuntime)' == '' and '$(RuntimeFlavor)' == 'Mono'">true</UseMonoRuntime>
333   </PropertyGroup>
334
335   <!-- Packaging -->
336   <PropertyGroup>
337     <GitHubRepositoryName>runtime</GitHubRepositoryName>
338     <RepositoryUrl>https://github.com/dotnet/$(GitHubRepositoryName)</RepositoryUrl>
339     <PackageProjectUrl>https://dot.net</PackageProjectUrl>
340     <Owners>microsoft,dotnetframework</Owners>
341     <IncludeSymbols>true</IncludeSymbols>
342     <LicenseFile>$(MSBuildThisFileDirectory)LICENSE.TXT</LicenseFile>
343     <PackageLicenseExpression>MIT</PackageLicenseExpression>
344     <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
345     <Copyright>$(CopyrightNetFoundation)</Copyright>
346     <PackageThirdPartyNoticesFile>$(MSBuildThisFileDirectory)THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>
347     <PackageReleaseNotes>https://go.microsoft.com/fwlink/?LinkID=799421</PackageReleaseNotes>
348     <IsPrivateAssembly>$(MSBuildProjectName.Contains('Private'))</IsPrivateAssembly>
349     <!-- Private packages should not be stable -->
350     <SuppressFinalPackageVersion Condition="'$(SuppressFinalPackageVersion)' == '' and $(IsPrivateAssembly)">true</SuppressFinalPackageVersion>
351     <!-- We don't want Private packages to be shipped to NuGet.org -->
352     <IsShippingPackage Condition="$(IsPrivateAssembly)">false</IsShippingPackage>
353     <PlaceholderFile>$(RepositoryEngineeringDir)_._</PlaceholderFile>
354   </PropertyGroup>
355
356   <!-- Flow these properties to consuming projects. -->
357   <ItemDefinitionGroup>
358     <TargetPathWithTargetPlatformMoniker>
359       <IsPrivateAssembly>$(IsPrivateAssembly.ToLowerInvariant())</IsPrivateAssembly>
360     </TargetPathWithTargetPlatformMoniker>
361   </ItemDefinitionGroup>
362
363   <!-- Language configuration -->
364   <PropertyGroup>
365     <!-- default to allowing all language features -->
366     <LangVersion>preview</LangVersion>
367     <!-- default to max warnlevel -->
368     <AnalysisLevel Condition="'$(MSBuildProjectExtension)' == '.csproj'">preview</AnalysisLevel>
369     <LangVersion Condition="'$(MSBuildProjectExtension)' == '.vbproj'">latest</LangVersion>
370     <!-- Enables Strict mode for Roslyn compiler -->
371     <Features>strict;nullablePublicOnly</Features>
372     <TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)' == ''">true</TreatWarningsAsErrors>
373     <!-- Warnings to always disable -->
374     <NoWarn>$(NoWarn),CS8969</NoWarn>
375     <!-- Always pass portable to override arcade sdk which uses embedded for local builds -->
376     <DebugType>portable</DebugType>
377     <DebugSymbols>true</DebugSymbols>
378     <KeepNativeSymbols Condition="'$(KeepNativeSymbols)' == '' and '$(DotNetBuildFromSource)' == 'true'">true</KeepNativeSymbols>
379     <KeepNativeSymbols Condition="'$(KeepNativeSymbols)' == ''">false</KeepNativeSymbols>
380     <!-- Used for launchSettings.json and runtime config files. -->
381     <AppDesignerFolder>Properties</AppDesignerFolder>
382     <!-- By default the SDK produces ref assembly for 5.0 or later -->
383     <ProduceReferenceAssembly>false</ProduceReferenceAssembly>
384   </PropertyGroup>
385
386   <!-- Define test projects and companions -->
387   <PropertyGroup Condition="$(MSBuildProjectFullPath.Contains('$([System.IO.Path]::DirectorySeparatorChar)tests$([System.IO.Path]::DirectorySeparatorChar)'))">
388     <IsTestProject Condition="$(MSBuildProjectName.EndsWith('.UnitTests')) or $(MSBuildProjectName.EndsWith('.Tests'))">true</IsTestProject>
389     <IsTrimmingTestProject Condition="$(MSBuildProjectName.EndsWith('.TrimmingTests'))">true</IsTrimmingTestProject>
390     <IsNativeAotTestProject Condition="$(MSBuildProjectName.EndsWith('.NativeAotTests'))">true</IsNativeAotTestProject>
391     <IsPublishedAppTestProject Condition="'$(IsTrimmingTestProject)' == 'true' or '$(IsNativeAotTestProject)' == 'true'">true</IsPublishedAppTestProject>
392     <IsTestSupportProject Condition="'$(IsTestProject)' != 'true' and '$(IsPublishedAppTestProject)' != 'true'">true</IsTestSupportProject>
393
394     <!-- Treat test assemblies as non-shipping (do not publish or sign them). -->
395     <IsShipping Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsPublishedAppTestProject)' == 'true'">false</IsShipping>
396   </PropertyGroup>
397
398   <PropertyGroup>
399     <!-- Treat as a generator project if either the parent or the parent parent directory is named gen. -->
400     <IsGeneratorProject Condition="$([System.IO.Path]::GetFileName('$(MSBuildProjectDirectory)')) == 'gen' or
401                                    $([System.IO.Path]::GetFileName('$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..'))')) == 'gen'">true</IsGeneratorProject>
402     <IsSourceProject Condition="'$(IsSourceProject)' == '' and
403                                 '$(IsReferenceAssemblyProject)' != 'true' and
404                                 '$(IsGeneratorProject)' != 'true' and
405                                 '$(IsTestProject)' != 'true' and
406                                 '$(IsPublishedAppTestProject)' != 'true' and
407                                 '$(IsTestSupportProject)' != 'true' and
408                                 '$(UsingMicrosoftDotNetSharedFrameworkSdk)' != 'true' and
409                                 '$(MSBuildProjectExtension)' != '.pkgproj' and
410                                 '$(UsingMicrosoftNoTargetsSdk)' != 'true' and
411                                 '$(UsingMicrosoftTraversalSdk)' != 'true'">true</IsSourceProject>
412   </PropertyGroup>
413
414   <PropertyGroup Condition="'$(IsReferenceAssemblyProject)' == 'true'">
415     <!-- Reference assemblies are special and don't initialize fields or have empty finalizers, etc. -->
416     <RunAnalyzers>false</RunAnalyzers>
417     <!-- disable warnings about unused fields -->
418     <NoWarn>$(NoWarn);CS0169;CS0649;CS8618</NoWarn>
419     <!-- disable CS8597 because we throw null on reference assemblies. -->
420     <NoWarn>$(NoWarn);CS8597</NoWarn>
421     <!-- We base calls from constructors with null literals. -->
422     <NoWarn>$(NoWarn);CS8625</NoWarn>
423     <!-- We dont need to add null annotation within the ref for explicit interface methods. -->
424     <NoWarn>$(NoWarn);CS8617</NoWarn>
425     <!-- No symbols are produced for ref assemblies, but some parts of the SDK still expect pdbs, so we explicitly tell it there are none. -->
426     <!-- Must be set after importing Arcade to override its defaults. -->
427     <DebugType>none</DebugType>
428     <!-- Don't try to publish PDBs for ref assemblies that have none. -->
429     <PublishWindowsPdb>false</PublishWindowsPdb>
430   </PropertyGroup>
431
432   <!-- All reference assemblies should have a ReferenceAssemblyAttribute and the 0x70 flag which prevents them from loading. -->
433   <ItemGroup Condition="'$(IsReferenceAssemblyProject)' == 'true'">
434     <AssemblyAttribute Include="System.Runtime.CompilerServices.ReferenceAssemblyAttribute" />
435     <AssemblyAttribute Include="System.Reflection.AssemblyFlags">
436       <_Parameter1>(System.Reflection.AssemblyNameFlags)0x70</_Parameter1>
437       <_Parameter1_IsLiteral>true</_Parameter1_IsLiteral>
438     </AssemblyAttribute>
439   </ItemGroup>
440
441   <PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
442     <!-- Must be defined in a props file as imports in Microsoft.DotNet.ApiCompat.Task.targets depend on it. -->
443     <ApiCompatValidateAssemblies>true</ApiCompatValidateAssemblies>
444   </PropertyGroup>
445
446   <PropertyGroup Condition="'$(IsGeneratorProject)' == 'true'">
447     <!-- Unique assembly versions increases(3x) the compiler throughput during reference package updates. -->
448     <AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
449     <!-- To suppress warnings about resetting the assembly version.-->
450     <AssemblyVersion />
451     <!-- Enforce extended rules around API usages in analyzers and generators to ensure our generators follow best practices. -->
452     <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
453   </PropertyGroup>
454
455   <!-- Warnings that should be disabled in our test projects. -->
456   <PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsPublishedAppTestProject)' == 'true'">
457     <!-- we need to re-enable BinaryFormatter within test projects since some tests exercise these code paths to ensure compat -->
458     <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
459     <!-- don't warn on usage of BinaryFormatter or legacy serialization infrastructure from test projects -->
460     <NoWarn>$(NoWarn);SYSLIB0011;SYSLIB0050;SYSLIB0051</NoWarn>
461     <!-- don't warn about unnecessary trim warning suppressions. can be removed with preview 6. -->
462     <NoWarn>$(NoWarn);IL2121</NoWarn>
463     <!-- allow nullable annotated files to be incorporated into tests without warning -->
464     <Nullable Condition="'$(Nullable)' == '' and '$(Language)' == 'C#'">annotations</Nullable>
465   </PropertyGroup>
466
467   <PropertyGroup>
468     <CustomBeforeNoTargets>$(RepositoryEngineeringDir)NoTargetsSdk.BeforeTargets.targets</CustomBeforeNoTargets>
469     <CustomAfterTraversalTargets>$(RepositoryEngineeringDir)TraversalSdk.AfterTargets.targets</CustomAfterTraversalTargets>
470   </PropertyGroup>
471 </Project>