Skip to content

Commit 21165e5

Browse files
committed
-NET5 and -NET6 suffixes allow to build projects for corresponding frameworks
1 parent 74d70f3 commit 21165e5

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

Directory.Build.props

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,38 @@
3737
<NoWarn Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">$(NoWarn);SYSLIB0011</NoWarn>
3838
</PropertyGroup>
3939

40+
<!-- Debug-NET6, Release-NET6 are mostly for development convenience -->
41+
<PropertyGroup Condition = "$(Configuration.Contains('NET6')) == 'true'">
42+
<!-- hard binding to net6, no property and env variable allowed -->
43+
<TargetFrameworks>net6.0</TargetFrameworks>
44+
</PropertyGroup>
45+
46+
<!-- Debug-NET5, Release-NET5 are mostly for development convenience -->
47+
<PropertyGroup Condition = "$(Configuration.Contains('NET5')) == 'true'">
48+
<!-- hard binding to net5, no property and env variable allowed-->
49+
<TargetFrameworks>net5.0</TargetFrameworks>
50+
</PropertyGroup>
51+
52+
<!--Release and Debug are for final builds, builds on build server, etc. Target frameworks are configurable here -->
53+
<PropertyGroup Label="Defaults" Condition="$(Configuration.Contains('NET5')) == 'false' AND $(Configuration.Contains('NET6')) == 'false'">
54+
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
55+
<TargetFrameworks>$(TargetFrameworks)</TargetFrameworks> <!-- the property -->
56+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">$(DO_TargetFrameworks)</TargetFrameworks> <!-- env var -->
57+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net6.0;net5.0</TargetFrameworks> <!-- fallback to default -->
58+
</PropertyGroup>
59+
4060
<PropertyGroup>
4161
<NoLogo>true</NoLogo>
4262
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
43-
<TargetFrameworks>$(TargetFrameworks)</TargetFrameworks> <!-- the property -->
44-
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">$(DO_TargetFrameworks)</TargetFrameworks> <!-- env var -->
45-
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net6.0;net5.0</TargetFrameworks> <!-- fallback to default -->
63+
<!--
64+
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
65+
<TargetFrameworks>$(TargetFrameworks)</TargetFrameworks>
66+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">$(DO_TargetFrameworks)</TargetFrameworks>
67+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net6.0;net5.0</TargetFrameworks>
68+
-->
4669
<LangVersion>9.0</LangVersion>
4770
<SolutionDir Condition="$(SolutionDir) == ''">$([MSBuild]::EnsureTrailingSlash(
4871
$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)', 'Orm.sln'))))</SolutionDir>
49-
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
5072
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
5173
<ArtifactsDir Condition="'$(ArtifactsDir)'==''">$(SolutionDir)_Build\</ArtifactsDir>
5274
<BaseIntermediateOutputPath>$(ArtifactsDir)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>

0 commit comments

Comments
 (0)