/
Directory.Build.props
36 lines (33 loc) · 1.82 KB
/
Directory.Build.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Import parent Directory.build.props -->
<Import Project="..\..\Directory.Build.props" />
<PropertyGroup>
<TargetNetFxVersion Condition="'$(TargetNetFxVersion)' == ''">net46</TargetNetFxVersion>
<TargetNetCoreVersion Condition="'$(ReferenceType)' == 'NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1'">netcoreapp3.1</TargetNetCoreVersion>
<TargetNetCoreVersion Condition="'$(TargetNetCoreVersion)' == ''">netcoreapp2.1</TargetNetCoreVersion>
<ReferenceType Condition="'$(ReferenceType)'==''">Project</ReferenceType>
</PropertyGroup>
<Choose>
<!-- Set Default Target Framework when building for Debug and Release configurations. (Visual Studio) -->
<When Condition="'$(TestTargetOS)' == '' AND ('$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release')">
<PropertyGroup>
<TargetFrameworks>$(TargetNetCoreVersion)</TargetFrameworks>
</PropertyGroup>
</When>
<!-- Set Target Framework when TestTargetOS is not empty. (Command Line) -->
<When Condition="'$(TestTargetOS)' != ''">
<PropertyGroup>
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp'">$(TargetNetCoreVersion)</TargetFrameworks>
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetfx'">$(TargetNetFxVersion)</TargetFrameworks>
</PropertyGroup>
</When>
<!-- Set Target Framework when TestTargetOS is empty and Configuration is neither Debug nor Release. (Visual Studio) -->
<Otherwise>
<PropertyGroup>
<TargetFrameworks>$(Configuration.Split('-')[0])</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>
</Project>