Set RuntimeFrameworkVersion in CoreFx.depproj
[platform/upstream/coreclr.git] / tests / src / Common / CoreFX / CoreFX.depproj
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" />
4   <PropertyGroup>
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>
14   </PropertyGroup>
15
16   <!-- Switch RuntimeIdentifier according to currently targeted OSGroup -->
17   <PropertyGroup>
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>
22
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.)
29       -->
30       <AdditionalRestoreArgs>/p:__BuildOS=$(__BuildOS) /p:__BuildType=$(__BuildType) /p:__BuildArch=$(__BuildArch)</AdditionalRestoreArgs>
31   </PropertyGroup>
32
33   <ItemGroup>
34
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)" />
37
38     <!-- dotnet.exe -->
39     <PackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(MicrosoftNETCoreAppVersion)" />
40
41     <!-- hostfxr.dll -->
42     <PackageReference Include="Microsoft.NETCore.DotNetHostResolver" Version="$(MicrosoftNETCoreAppVersion)" />
43
44     <!-- hostpolicy.dll -->
45     <PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="$(MicrosoftNETCoreAppVersion)" />
46
47   </ItemGroup>
48
49   <!-- Target SetupTestingHost needs to run after "AfterResolveReferences" so @(ReferenceCopyLocalPaths) is
50        set up, and before "BeforeCompile" because @(ReferenceCopyLocalPaths) is cleared out during the
51        compile phase.
52   -->
53   <Target Name="SetupTestingHost" AfterTargets="AfterResolveReferences" BeforeTargets="BeforeCompile">
54
55     <Error Condition="'$(CORE_ROOT)' == ''"
56            Text="CORE_ROOT variable is not set." />
57
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>
64     </PropertyGroup>
65
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>
73     </PropertyGroup>
74
75     <ItemGroup>
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
78       -->
79       <!--
80       <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
81       -->
82
83       <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
84       <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
85
86       <!-- Exclude subdirectories that contain cross-architecture (possibly cross-bitness) crossgen/JIT -->
87       <TestDependenciesToExclude Include="$(CORE_ROOT)\**\x64\*"/>
88
89       <!-- Don't include all the nuget files -->
90       <TestDependenciesToExclude Include="$(CORE_ROOT)\.nuget\**\*"/>
91
92       <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
93     </ItemGroup>
94
95     <ItemGroup>
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?
98       -->
99       <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
100     </ItemGroup>
101
102     <ItemGroup>
103       <HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostFxrFileName)'" />
104       <DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
105       <HostPolicyFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostPolicyFileName)'" />
106     </ItemGroup>
107
108     <Copy SourceFiles="@(HostFxFile)"
109           DestinationFolder="$(NETCoreAppTestHostFxrPath)"
110           SkipUnchangedFiles="true"
111           UseHardlinksIfPossible="true" />
112
113     <Copy SourceFiles="@(HostPolicyFile)"
114           DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
115           SkipUnchangedFiles="true"
116           UseHardlinksIfPossible="true" />
117
118     <Copy SourceFiles="@(DotnetExe)"
119           DestinationFolder="$(TestHostRootPath)"
120           SkipUnchangedFiles="true"
121           UseHardlinksIfPossible="true"  />
122
123     <Copy SourceFiles="@(CoreCLRBinaries)"
124           DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
125           SkipUnchangedFiles="true" />
126
127     <Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(OSGroup)' != 'Windows_NT'"/>
128   </Target>
129
130   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
131
132   <PropertyGroup>
133     <ProjectAssetsFile>$(SourceDir)Common\CoreFX\obj\project.assets.json</ProjectAssetsFile>
134   </PropertyGroup>
135 </Project>