Skip to content

Commit 794092b

Browse files
Copilotstephentoub
andcommitted
Add AOT compatibility test app project
Add a console application that references all three library packages (ModelContextProtocol.Core, ModelContextProtocol, ModelContextProtocol.AspNetCore) and is published with PublishAot=true. This ensures that any AOT/trimming warnings from the libraries are caught during CI, following the pattern from dotnet/extensions. Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent fd68bbc commit 794092b

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/ci-build-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
- name: 🧪 Test
6969
run: make test CONFIGURATION=${{ matrix.configuration }}
7070

71+
- name: 🧪 AOT Compatibility
72+
if: matrix.configuration == 'Release'
73+
run: dotnet publish tests/ModelContextProtocol.AotCompatibility.TestApp/ModelContextProtocol.AotCompatibility.TestApp.csproj --configuration Release
74+
7175
- name: 📦 Pack
7276
if: matrix.configuration == 'Release'
7377
run: make pack CONFIGURATION=${{ matrix.configuration }}

ModelContextProtocol.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
</Folder>
7171
<Folder Name="/tests/">
7272
<Project Path="tests/ModelContextProtocol.Analyzers.Tests/ModelContextProtocol.Analyzers.Tests.csproj" />
73+
<Project Path="tests/ModelContextProtocol.AotCompatibility.TestApp/ModelContextProtocol.AotCompatibility.TestApp.csproj" />
7374
<Project Path="tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj" />
7475
<Project Path="tests/ModelContextProtocol.ConformanceClient/ModelContextProtocol.ConformanceClient.csproj" />
7576
<Project Path="tests/ModelContextProtocol.ConformanceServer/ModelContextProtocol.ConformanceServer.csproj" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<!-- Ensure TargetFrameworks is not inherited -->
7+
<TargetFrameworks></TargetFrameworks>
8+
<PublishAot>true</PublishAot>
9+
<TrimmerSingleWarn>false</TrimmerSingleWarn>
10+
<!-- Suppress the experimental tasks warning -->
11+
<NoWarn>$(NoWarn);MCPEXP001</NoWarn>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\src\ModelContextProtocol.Core\ModelContextProtocol.Core.csproj" />
16+
<ProjectReference Include="..\..\src\ModelContextProtocol\ModelContextProtocol.csproj" />
17+
<ProjectReference Include="..\..\src\ModelContextProtocol.AspNetCore\ModelContextProtocol.AspNetCore.csproj" />
18+
19+
<TrimmerRootAssembly Include="ModelContextProtocol.Core" />
20+
<TrimmerRootAssembly Include="ModelContextProtocol" />
21+
<TrimmerRootAssembly Include="ModelContextProtocol.AspNetCore" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
System.Console.WriteLine("Success!");

0 commit comments

Comments
 (0)