Skip to content

Commit

Permalink
Add test TFM for netstandard2.1 TFM
Browse files Browse the repository at this point in the history
Right now, tests are now executed for the `netstandard2.1` TFM of the library. This change adds an OS specific TFM to the test project specifically used to test the `netstandard2.1` TFM. The same technique was applied to the benchmarks.
  • Loading branch information
craigktreasure committed Nov 16, 2023
1 parent 8c22360 commit 602b59d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<PropertyGroup Condition="!$([MSBuild]::IsOSPlatform('Linux'))">
<!-- Setup TFM properties for testing .NET Standard TFM's on supported platforms. -->
<PlatformTFMSuffix Condition="$([MSBuild]::IsOSPlatform('Windows'))">-windows</PlatformTFMSuffix>
<PlatformTFMSuffix Condition="$([MSBuild]::IsOSPlatform('OSX'))">-macos</PlatformTFMSuffix>
<DefaultNetStandardTestTFM >net6.0$(PlatformTFMSuffix)</DefaultNetStandardTestTFM>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)/../Directory.Build.props" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Linux'))">$(TargetFrameworks);net7.0$(PlatformTFMSuffix);net6.0$(PlatformTFMSuffix)</TargetFrameworks>
<RootNamespace>Treasure.Utils.Benchmarks</RootNamespace>
<IsTestProject>false</IsTestProject>

Expand All @@ -16,6 +17,9 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Treasure.Utils.Argument\Treasure.Utils.Argument.csproj" />
<ProjectReference Update="..\..\src\Treasure.Utils.Argument\Treasure.Utils.Argument.csproj"
Condition="$(TargetFramework.Contains($(PlatformTFMSuffix)))"
SetTargetFramework="TargetFramework=netstandard2.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Linux'))">$(TargetFrameworks);$(DefaultNetStandardTestTFM)</TargetFrameworks>
<RootNamespace>Treasure.Utils.Tests</RootNamespace>

<IsPackable>false</IsPackable>
Expand All @@ -27,6 +28,9 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Treasure.Utils.Argument\Treasure.Utils.Argument.csproj" />
<ProjectReference Update="..\..\src\Treasure.Utils.Argument\Treasure.Utils.Argument.csproj"
Condition="$(TargetFramework.Contains($(PlatformTFMSuffix)))"
SetTargetFramework="TargetFramework=netstandard2.1" />
</ItemGroup>

</Project>

0 comments on commit 602b59d

Please sign in to comment.