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 <RuntimeFrameworkVersion>$(MicrosoftNETCoreAppVersion)</RuntimeFrameworkVersion>
10 <ContainsPackageReferences>true</ContainsPackageReferences>
11 <CLRTestKind>SharedLibrary</CLRTestKind>
12 <IsTestProject>false</IsTestProject>
13 <MicrosoftDiagnosticsRuntimePackageVersion>1.0.5</MicrosoftDiagnosticsRuntimePackageVersion>
16 <!-- Switch RuntimeIdentifier according to currently targeted OSGroup -->
18 <RuntimeIdentifier Condition="'$(OSGroup)' == 'Windows_NT'">win-$(Platform)</RuntimeIdentifier>
19 <RuntimeIdentifier Condition="'$(OSGroup)' == 'Linux'">linux-$(Platform)</RuntimeIdentifier>
20 <RuntimeIdentifier Condition="'$(OSGroup)' == 'OSX'">osx-$(Platform)</RuntimeIdentifier>
21 <NugetRuntimeIdentifier>$(RuntimeIdentifier)</NugetRuntimeIdentifier>
23 <!-- Set AdditionalRestoreArgs so the _DnuRestoreCommandFull in Tools\packageresolve.targets
24 passes these on to 'dotnet restore'. This is needed so all the various dirs.props files
25 set up the target architecture correctly, so $(Platform) above gets set correctly, among
26 other things. (Note that _DnuRestoreCommandFull doesn't properly set
27 TargetGroup/ConfigurationGroup/ArchGroup, and even if they are set, it isn't used by
28 the various dirs.props files.)
30 <AdditionalRestoreArgs>/p:__BuildOS=$(__BuildOS) /p:__BuildType=$(__BuildType) /p:__BuildArch=$(__BuildArch)</AdditionalRestoreArgs>
35 <!-- Microsoft.Private.CoreFx.OOB is a meta-package that contains references to most of what we need -->
36 <PackageReference Include="Microsoft.Private.CoreFx.OOB" Version="$(MicrosoftPrivateCoreFxNETCoreAppVersion)" />
39 <PackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(MicrosoftNETCoreAppVersion)" />
42 <PackageReference Include="Microsoft.NETCore.DotNetHostResolver" Version="$(MicrosoftNETCoreAppVersion)" />
44 <!-- hostpolicy.dll -->
45 <PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="$(MicrosoftNETCoreAppVersion)" />
49 <!-- Target SetupTestingHost needs to run after "AfterResolveReferences" so @(ReferenceCopyLocalPaths) is
50 set up, and before "BeforeCompile" because @(ReferenceCopyLocalPaths) is cleared out during the
53 <Target Name="SetupTestingHost" AfterTargets="AfterResolveReferences" BeforeTargets="BeforeCompile">
55 <Error Condition="'$(CORE_ROOT)' == ''"
56 Text="CORE_ROOT variable is not set." />
58 <PropertyGroup Condition="'$(OSGroup)'=='Windows_NT'">
59 <HostFxrFileName>hostfxr</HostFxrFileName>
60 <HostFxrFileExtension>dll</HostFxrFileExtension>
61 <DotnetExecutableName>dotnet.exe</DotnetExecutableName>
62 <HostPolicyFileName>hostpolicy</HostPolicyFileName>
63 <HostPolicyExtension>dll</HostPolicyExtension>
66 <PropertyGroup Condition="'$(OSGroup)'!='Windows_NT'">
67 <HostFxrFileName>libhostfxr</HostFxrFileName>
68 <HostFxrFileExtension Condition="'$(OSGroup)' == 'Linux' Or '$(OSGroup)' == 'FreeBSD'">so</HostFxrFileExtension>
69 <HostFxrFileExtension Condition="$(OSGroup) =='OSX'">dylib</HostFxrFileExtension>
70 <HostPolicyFileName>libhostpolicy</HostPolicyFileName>
71 <HostPolicyExtension>$(HostFxrFileExtension)</HostPolicyExtension>
72 <DotnetExecutableName>dotnet</DotnetExecutableName>
76 <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency
77 The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root
80 <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
83 <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
84 <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
86 <!-- Exclude subdirectories that contain cross-architecture (possibly cross-bitness) crossgen/JIT -->
87 <TestDependenciesToExclude Include="$(CORE_ROOT)\**\x64\*"/>
89 <!-- Don't include all the nuget files -->
90 <TestDependenciesToExclude Include="$(CORE_ROOT)\.nuget\**\*"/>
92 <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
96 <!-- REVIEW: do we need to copy recursively (and flatten the structure into a single destination folder)? Can we just copy
97 the top level? Or, should we preserve the hierarchy?
99 <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
103 <HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostFxrFileName)'" />
104 <DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
105 <HostPolicyFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostPolicyFileName)'" />
108 <Copy SourceFiles="@(HostFxFile)"
109 DestinationFolder="$(NETCoreAppTestHostFxrPath)"
110 SkipUnchangedFiles="true"
111 UseHardlinksIfPossible="true" />
113 <Copy SourceFiles="@(HostPolicyFile)"
114 DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
115 SkipUnchangedFiles="true"
116 UseHardlinksIfPossible="true" />
118 <Copy SourceFiles="@(DotnetExe)"
119 DestinationFolder="$(TestHostRootPath)"
120 SkipUnchangedFiles="true"
121 UseHardlinksIfPossible="true" />
123 <Copy SourceFiles="@(CoreCLRBinaries)"
124 DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
125 SkipUnchangedFiles="true" />
127 <Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(OSGroup)' != 'Windows_NT'"/>
130 <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
133 <ProjectAssetsFile>$(SourceDir)Common\CoreFX\obj\project.assets.json</ProjectAssetsFile>