1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
3 <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
5 <RestoreOutputPath>$(SourceDir)Common\CoreFX\obj</RestoreOutputPath>
6 <Language>C#</Language>
7 <NugetTargetMoniker>.NETCoreApp,Version=v3.1</NugetTargetMoniker>
8 <TargetFramework>netcoreapp3.1</TargetFramework>
9 <ContainsPackageReferences>true</ContainsPackageReferences>
10 <CLRTestKind>SharedLibrary</CLRTestKind>
11 <IsTestProject>false</IsTestProject>
12 <MicrosoftDiagnosticsRuntimePackageVersion>1.0.5</MicrosoftDiagnosticsRuntimePackageVersion>
15 <!-- Switch RuntimeIdentifier according to currently targeted OSGroup -->
17 <RuntimeIdentifier Condition="'$(OSGroup)' == 'Windows_NT'">win-$(Platform)</RuntimeIdentifier>
18 <RuntimeIdentifier Condition="'$(OSGroup)' == 'Linux'">linux-$(Platform)</RuntimeIdentifier>
19 <RuntimeIdentifier Condition="'$(OSGroup)' == 'OSX'">osx-$(Platform)</RuntimeIdentifier>
20 <NugetRuntimeIdentifier>$(RuntimeIdentifier)</NugetRuntimeIdentifier>
22 <!-- Set AdditionalRestoreArgs so the _DnuRestoreCommandFull in Tools\packageresolve.targets
23 passes these on to 'dotnet restore'. This is needed so all the various dirs.props files
24 set up the target architecture correctly, so $(Platform) above gets set correctly, among
25 other things. (Note that _DnuRestoreCommandFull doesn't properly set
26 TargetGroup/ConfigurationGroup/ArchGroup, and even if they are set, it isn't used by
27 the various dirs.props files.)
29 <AdditionalRestoreArgs>/p:__BuildOS=$(__BuildOS) /p:__BuildType=$(__BuildType) /p:__BuildArch=$(__BuildArch)</AdditionalRestoreArgs>
34 <!-- Microsoft.Private.CoreFx.OOB is a meta-package that contains references to most of what we need -->
35 <PackageReference Include="Microsoft.Private.CoreFx.OOB" Version="$(MicrosoftPrivateCoreFxNETCoreAppVersion)" />
38 <PackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(MicrosoftNETCoreAppVersion)" />
41 <PackageReference Include="Microsoft.NETCore.DotNetHostResolver" Version="$(MicrosoftNETCoreAppVersion)" />
43 <!-- hostpolicy.dll -->
44 <PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="$(MicrosoftNETCoreAppVersion)" />
48 <!-- Target SetupTestingHost needs to run after "AfterResolveReferences" so @(ReferenceCopyLocalPaths) is
49 set up, and before "BeforeCompile" because @(ReferenceCopyLocalPaths) is cleared out during the
52 <Target Name="SetupTestingHost" AfterTargets="AfterResolveReferences" BeforeTargets="BeforeCompile">
54 <Error Condition="'$(CORE_ROOT)' == ''"
55 Text="CORE_ROOT variable is not set." />
57 <PropertyGroup Condition="'$(OSGroup)'=='Windows_NT'">
58 <HostFxrFileName>hostfxr</HostFxrFileName>
59 <HostFxrFileExtension>dll</HostFxrFileExtension>
60 <DotnetExecutableName>dotnet.exe</DotnetExecutableName>
61 <HostPolicyFileName>hostpolicy</HostPolicyFileName>
62 <HostPolicyExtension>dll</HostPolicyExtension>
65 <PropertyGroup Condition="'$(OSGroup)'!='Windows_NT'">
66 <HostFxrFileName>libhostfxr</HostFxrFileName>
67 <HostFxrFileExtension Condition="'$(OSGroup)' == 'Linux' Or '$(OSGroup)' == 'FreeBSD'">so</HostFxrFileExtension>
68 <HostFxrFileExtension Condition="$(OSGroup) =='OSX'">dylib</HostFxrFileExtension>
69 <HostPolicyFileName>libhostpolicy</HostPolicyFileName>
70 <HostPolicyExtension>$(HostFxrFileExtension)</HostPolicyExtension>
71 <DotnetExecutableName>dotnet</DotnetExecutableName>
75 <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency
76 The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root
79 <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
82 <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
83 <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
85 <!-- Exclude subdirectories that contain cross-architecture (possibly cross-bitness) crossgen/JIT -->
86 <TestDependenciesToExclude Include="$(CORE_ROOT)\**\x64\*"/>
88 <!-- Don't include all the nuget files -->
89 <TestDependenciesToExclude Include="$(CORE_ROOT)\.nuget\**\*"/>
91 <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
95 <!-- REVIEW: do we need to copy recursively (and flatten the structure into a single destination folder)? Can we just copy
96 the top level? Or, should we preserve the hierarchy?
98 <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
102 <HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostFxrFileName)'" />
103 <DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
104 <HostPolicyFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostPolicyFileName)'" />
107 <Copy SourceFiles="@(HostFxFile)"
108 DestinationFolder="$(NETCoreAppTestHostFxrPath)"
109 SkipUnchangedFiles="true"
110 UseHardlinksIfPossible="true" />
112 <Copy SourceFiles="@(HostPolicyFile)"
113 DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
114 SkipUnchangedFiles="true"
115 UseHardlinksIfPossible="true" />
117 <Copy SourceFiles="@(DotnetExe)"
118 DestinationFolder="$(TestHostRootPath)"
119 SkipUnchangedFiles="true"
120 UseHardlinksIfPossible="true" />
122 <Copy SourceFiles="@(CoreCLRBinaries)"
123 DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
124 SkipUnchangedFiles="true" />
126 <Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(OSGroup)' != 'Windows_NT'"/>
129 <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
132 <ProjectAssetsFile>$(SourceDir)Common\CoreFX\obj\project.assets.json</ProjectAssetsFile>