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-$(TargetRid)</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 <!-- Workaround to exclude runtime assets from this package while we fix a bug in CoreFx -->
36 <PackageReference Include="System.IO.FileSystem.AccessControl" Version="$(SystemIOFileSystemAccessControlVersion)" ExcludeAssets="Runtime" />
38 <!-- Microsoft.Private.CoreFx.OOB is a meta-package that contains references to most of what we need -->
39 <PackageReference Include="Microsoft.Private.CoreFx.OOB" Version="$(MicrosoftPrivateCoreFxNETCoreAppVersion)" />
42 <PackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(MicrosoftNETCoreAppVersion)" />
45 <PackageReference Include="Microsoft.NETCore.DotNetHostResolver" Version="$(MicrosoftNETCoreAppVersion)" />
47 <!-- hostpolicy.dll -->
48 <PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="$(MicrosoftNETCoreAppVersion)" />
52 <!-- Target SetupTestingHost needs to run after "AfterResolveReferences" so @(ReferenceCopyLocalPaths) is
53 set up, and before "BeforeCompile" because @(ReferenceCopyLocalPaths) is cleared out during the
56 <Target Name="SetupTestingHost" AfterTargets="AfterResolveReferences" BeforeTargets="BeforeCompile">
58 <Error Condition="'$(CORE_ROOT)' == ''"
59 Text="CORE_ROOT variable is not set." />
61 <PropertyGroup Condition="'$(OSGroup)'=='Windows_NT'">
62 <HostFxrFileName>hostfxr</HostFxrFileName>
63 <HostFxrFileExtension>dll</HostFxrFileExtension>
64 <DotnetExecutableName>dotnet.exe</DotnetExecutableName>
65 <HostPolicyFileName>hostpolicy</HostPolicyFileName>
66 <HostPolicyExtension>dll</HostPolicyExtension>
69 <PropertyGroup Condition="'$(OSGroup)'!='Windows_NT'">
70 <HostFxrFileName>libhostfxr</HostFxrFileName>
71 <HostFxrFileExtension Condition="'$(OSGroup)' == 'Linux' Or '$(OSGroup)' == 'FreeBSD'">so</HostFxrFileExtension>
72 <HostFxrFileExtension Condition="$(OSGroup) =='OSX'">dylib</HostFxrFileExtension>
73 <HostPolicyFileName>libhostpolicy</HostPolicyFileName>
74 <HostPolicyExtension>$(HostFxrFileExtension)</HostPolicyExtension>
75 <DotnetExecutableName>dotnet</DotnetExecutableName>
79 <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency
80 The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root
83 <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
86 <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
87 <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
89 <!-- Exclude subdirectories that contain cross-architecture (possibly cross-bitness) crossgen/JIT -->
90 <TestDependenciesToExclude Include="$(CORE_ROOT)\**\x64\*"/>
92 <!-- Don't include all the nuget files -->
93 <TestDependenciesToExclude Include="$(CORE_ROOT)\.nuget\**\*"/>
95 <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
99 <!-- REVIEW: do we need to copy recursively (and flatten the structure into a single destination folder)? Can we just copy
100 the top level? Or, should we preserve the hierarchy?
102 <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
106 <HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostFxrFileName)'" />
107 <DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
108 <HostPolicyFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostPolicyFileName)'" />
111 <Copy SourceFiles="@(HostFxFile)"
112 DestinationFolder="$(NETCoreAppTestHostFxrPath)"
113 SkipUnchangedFiles="true"
114 UseHardlinksIfPossible="true" />
116 <Copy SourceFiles="@(HostPolicyFile)"
117 DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
118 SkipUnchangedFiles="true"
119 UseHardlinksIfPossible="true" />
121 <Copy SourceFiles="@(DotnetExe)"
122 DestinationFolder="$(TestHostRootPath)"
123 SkipUnchangedFiles="true"
124 UseHardlinksIfPossible="true" />
126 <Copy SourceFiles="@(CoreCLRBinaries)"
127 DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
128 SkipUnchangedFiles="true" />
130 <Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(OSGroup)' != 'Windows_NT'"/>
133 <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
136 <ProjectAssetsFile>$(SourceDir)Common\CoreFX\obj-$(TargetRid)\project.assets.json</ProjectAssetsFile>