Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsVersion)" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="$(System10Version)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="$(System10Version)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="$(System10Version)" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(System10Version)" />
Expand Down
1 change: 1 addition & 0 deletions ModelContextProtocol.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<Project Path="tests/ModelContextProtocol.ConformanceServer/ModelContextProtocol.ConformanceServer.csproj" />
<Project Path="tests/ModelContextProtocol.TestOAuthServer/ModelContextProtocol.TestOAuthServer.csproj" />
<Project Path="tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj" />
<Project Path="tests/ModelContextProtocol.Netstandard2_0.Tests/ModelContextProtocol.Netstandard2_0.Tests.csproj" />
<Project Path="tests/ModelContextProtocol.TestServer/ModelContextProtocol.TestServer.csproj" />
<Project Path="tests/ModelContextProtocol.TestSseServer/ModelContextProtocol.TestSseServer.csproj" />
<Project Path="tests/ModelContextProtocol.ExperimentalApiRegressionTest/ModelContextProtocol.ExperimentalApiRegressionTest.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<Project Sdk="Microsoft.NET.Sdk">

<!--
This project provides test coverage for the netstandard2.0 assets of the MCP libraries on a modern
.NET runtime (i.e. independent of .NET Framework). It compiles the same test sources as
ModelContextProtocol.Tests, but forces the product project references to resolve to their
netstandard2.0 build via SetTargetFramework.

On Windows, the netstandard2.0 assets are also exercised through the net472 target of
ModelContextProtocol.Tests (on .NET Framework); this project additionally validates them on a
modern .NET runtime on every platform.

The stdio/external-process integration tests are excluded: they launch a separate net8.0 TestServer
process whose (net8.0) product assemblies cannot coexist with the netstandard2.0 product assemblies
under test in the same output directory. Those scenarios remain covered by ModelContextProtocol.Tests.
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<RootNamespace>ModelContextProtocol.Tests</RootNamespace>
<!-- https://github.com/dotnet/sdk/issues/51060 -->
<NoWarn>$(NoWarn);NU1903;NU1902</NoWarn>
<!-- Define for conditional TimeProvider support in InMemoryMcpTaskStore -->
<DefineConstants>$(DefineConstants);MCP_TEST_TIME_PROVIDER</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<!-- Without this, tests are currently not showing results until all tests complete
https://xunit.net/docs/getting-started/v3/microsoft-testing-platform
-->
<DisableTestingPlatformServerCapability>true</DisableTestingPlatformServerCapability>
</PropertyGroup>

<!-- Compile the same test sources as ModelContextProtocol.Tests, excluding the external-process
integration tests (see comment above). -->
<ItemGroup>
<Compile Include="..\ModelContextProtocol.Tests\**\*.cs"
Exclude="..\ModelContextProtocol.Tests\obj\**\*.cs;..\ModelContextProtocol.Tests\bin\**\*.cs;..\ModelContextProtocol.Tests\ClientIntegrationTestFixture.cs;..\ModelContextProtocol.Tests\ClientIntegrationTests.cs;..\ModelContextProtocol.Tests\StdioServerIntegrationTests.cs;..\ModelContextProtocol.Tests\DockerEverythingServerTests.cs;..\ModelContextProtocol.Tests\Transport\StdioClientTransportTests.cs" />
<Compile Include="..\Common\**\*.cs" />
<!-- Link InMemoryMcpTaskStore.cs for testing with TimeProvider support -->
<Compile Include="..\..\src\ModelContextProtocol.Core\Server\InMemoryMcpTaskStore.cs" Link="Server\InMemoryMcpTaskStore.cs" />
<!-- Include dependencies for the linked InMemoryMcpTaskStore.cs -->
<Compile Include="..\..\src\Common\Experimentals.cs" Link="Experimentals.cs" />
<Compile Include="..\..\src\Common\McpHttpHeaders.cs" Link="McpHttpHeaders.cs" />
<Compile Include="..\..\src\ModelContextProtocol\Server\DistributedCacheEventIdFormatter.cs" Link="DistributedCacheEventIdFormatter.cs" />
<Compile Include="..\..\src\Common\Polyfills\System\IdHelpers.cs" Link="Polyfills\IdHelpers.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<!-- The netstandard2.0 product assemblies depend on Microsoft.Bcl.AsyncInterfaces 10.x, but a
transitive netstandard2.1 dependency pulls in 6.0.0, which would otherwise win and cause a
FileNotFoundException at runtime. Reference it explicitly so the 10.x build is deployed. -->
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Microsoft.Extensions.AI" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<!-- Provides the Host static class used by tests. In ModelContextProtocol.Tests this comes
transitively from the TestServer project references, which aren't used here. -->
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="OpenTelemetry" />
<PackageReference Include="OpenTelemetry.Exporter.InMemory" />
<PackageReference Include="Serilog" />
<PackageReference Include="JsonSchema.Net" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<!-- net8.0 is not net10.0-compatible, so the polyfill package is required. -->
<PackageReference Include="System.Linq.AsyncEnumerable" />
</ItemGroup>

<ItemGroup>
<!-- Force the product references to resolve to their netstandard2.0 build. -->
<ProjectReference Include="..\..\src\ModelContextProtocol\ModelContextProtocol.csproj">
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
<ProjectReference Include="..\..\src\ModelContextProtocol.Core\ModelContextProtocol.Core.csproj">
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
</ItemGroup>

</Project>