Skip to content

Commit dba4ef8

Browse files
committed
Implementation
1 parent d6718f6 commit dba4ef8

File tree

4 files changed

+94
-4
lines changed

4 files changed

+94
-4
lines changed
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
{
22
"$schema": "https://json.schemastore.org/dotnetcli.host",
3-
"symbolInfo": {},
3+
"symbolInfo": {
4+
"TargetFrameworkOverride": {
5+
"isHidden": "true",
6+
"longName": "target-framework-override",
7+
"shortName": ""
8+
},
9+
"Framework": {
10+
"longName": "framework"
11+
},
12+
"NativeAot": {
13+
"longName": "aot",
14+
"shortName": ""
15+
},
16+
"SelfContained": {
17+
"longName": "self-contained",
18+
"shortName": ""
19+
}
20+
},
421
"usageExamples": [
522
""
623
]
7-
}
24+
}

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/McpServer/McpServer-CSharp/.template.config/ide.host.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,14 @@
22
"$schema": "https://json.schemastore.org/ide.host",
33
"order": 0,
44
"icon": "ide/icon.ico",
5-
"symbolInfo": []
5+
"symbolInfo": [
6+
{
7+
"id": "NativeAot",
8+
"isVisible": true
9+
},
10+
{
11+
"id": "SelfContained",
12+
"isVisible": true
13+
}
14+
]
615
}

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/McpServer/McpServer-CSharp/.template.config/template.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,53 @@
1818
"type": "project"
1919
},
2020
"symbols": {
21+
"TargetFrameworkOverride": {
22+
"type": "parameter",
23+
"description": "Overrides the target framework",
24+
"displayName": "Target framework override",
25+
"replaces": "TargetFrameworkOverride",
26+
"datatype": "string",
27+
"defaultValue": ""
28+
},
29+
"Framework": {
30+
"type": "parameter",
31+
"description": "The target framework for the project.",
32+
"displayName": "Framework",
33+
"datatype": "choice",
34+
"choices": [
35+
{
36+
"choice": "net10.0",
37+
"description": ".NET 10"
38+
},
39+
{
40+
"choice": "net9.0",
41+
"description": ".NET 9"
42+
},
43+
{
44+
"choice": "net8.0",
45+
"description": ".NET 8"
46+
}
47+
],
48+
"replaces": "net9.0",
49+
"defaultValue": "net9.0"
50+
},
2151
"hostIdentifier": {
2252
"type": "bind",
2353
"binding": "HostIdentifier"
54+
},
55+
"NativeAot": {
56+
"type": "parameter",
57+
"datatype": "bool",
58+
"defaultValue": "false",
59+
"displayName": "Enable _native AOT publish",
60+
"description": "Whether to enable the MCP server for publishing as a native AOT application."
61+
},
62+
"SelfContained": {
63+
"type": "parameter",
64+
"datatype": "bool",
65+
"defaultValue": "true",
66+
"displayName": "Enable _self contained publish",
67+
"description": "Whether to enable the MCP server for publishing as a self contained application."
2468
}
2569
},
2670
"primaryOutputs": [

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/McpServer/McpServer-CSharp/McpServer-CSharp.csproj.in

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">net9.0</TargetFramework>
5+
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework>
6+
<!--#if (SelfContained || NativeAot)-->
7+
<RuntimeIdentifiers>win-x64;win-arm64;osx-arm64;linux-x64;linux-arm64</RuntimeIdentifiers>
8+
<!--#else-->
59
<RollForward>Major</RollForward>
10+
<!--#endif -->
611
<OutputType>Exe</OutputType>
712
<Nullable>enable</Nullable>
813
<ImplicitUsings>enable</ImplicitUsings>
914

1015
<!-- Set up the NuGet package to be an MCP server -->
1116
<PackAsTool>true</PackAsTool>
1217
<PackageType>McpServer</PackageType>
18+
<!--#if (SelfContained || NativeAot)-->
19+
20+
<!-- Set up the MCP server to be a self-contained application that does not rely on a shared framework -->
21+
<SelfContained>true</SelfContained>
22+
<PublishSelfContained>true</PublishSelfContained>
23+
24+
<!-- Set up the MCP server to be a single file executable -->
25+
<PublishSingleFile>true</PublishSingleFile>
26+
<!--#endif -->
27+
<!--#if (NativeAot)-->
28+
29+
<!-- Configure the MCP server to be a native AOT application with invariant globalization -->
30+
<PublishAot>true</PublishAot>
31+
<InvariantGlobalization>true</InvariantGlobalization>
32+
<!--#endif -->
1333

1434
<!-- Set recommended package metadata -->
1535
<PackageReadmeFile>README.md</PackageReadmeFile>

0 commit comments

Comments
 (0)