Skip to content

Commit 259aee5

Browse files
Revert "Remove platform-specific DefaultTestTargetFrameworks"
This reverts the changes from commit db11c07. The approach of removing net472 on Windows was incorrect. We need to maintain both: 1. net472 tests on Windows (for netstandard2.0 testing on .NET Framework) 2. Conditional SetTargetFramework on non-Windows (for netstandard2.0 testing on modern .NET) Restoring the configuration where: - Windows tests: net10.0, net9.0, net8.0, net472 - Non-Windows tests: net10.0, net9.0, net8.0 (with net8.0 using netstandard2.0 build) Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
1 parent db11c07 commit 259aee5

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
</PropertyGroup>
4848

4949
<PropertyGroup>
50-
<!-- Shared target frameworks for test projects and test support projects. -->
50+
<!-- Shared target frameworks for test projects and test support projects. net472 is only included on Windows. -->
5151
<DefaultTestTargetFrameworks>net10.0;net9.0;net8.0</DefaultTestTargetFrameworks>
52+
<DefaultTestTargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(DefaultTestTargetFrameworks);net472</DefaultTestTargetFrameworks>
5253
</PropertyGroup>
5354
</Project>

tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979

8080
<ItemGroup>
8181
<ProjectReference Include="..\..\src\ModelContextProtocol.Core\ModelContextProtocol.Core.csproj">
82-
<!-- Force net8.0 tests to use netstandard2.0 build for netstandard2.0 test coverage on all platforms -->
83-
<SetTargetFramework Condition="'$(TargetFramework)' == 'net8.0'">TargetFramework=netstandard2.0</SetTargetFramework>
82+
<!-- On non-Windows platforms, force net8.0 tests to use netstandard2.0 build for cross-platform netstandard2.0 coverage -->
83+
<SetTargetFramework Condition="'$(TargetFramework)' == 'net8.0' AND !$([MSBuild]::IsOSPlatform('Windows'))">TargetFramework=netstandard2.0</SetTargetFramework>
8484
</ProjectReference>
8585
<ProjectReference Include="..\ModelContextProtocol.TestServer\ModelContextProtocol.TestServer.csproj" />
8686
<ProjectReference Include="..\..\samples\TestServerWithHosting\TestServerWithHosting.csproj" />

0 commit comments

Comments
 (0)