Skip to content

Commit 318def4

Browse files
committed
WIP
1 parent d6718f6 commit 318def4

File tree

4 files changed

+111
-4
lines changed

4 files changed

+111
-4
lines changed
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
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+
"SingleFile": {
21+
"longName": "single-file",
22+
"shortName": ""
23+
}
24+
},
425
"usageExamples": [
526
""
627
]
7-
}
28+
}

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,18 @@
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+
{
15+
"id": "SingleFile",
16+
"isVisible": true
17+
}
18+
]
619
}

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,60 @@
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."
68+
},
69+
"SingleFile": {
70+
"type": "parameter",
71+
"datatype": "bool",
72+
"defaultValue": "true",
73+
"displayName": "Enable single file publish",
74+
"description": "Whether to enable the MCP server for publishing as a single file executable."
2475
}
2576
},
2677
"primaryOutputs": [

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
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 || SingleFile || 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 || SingleFile || 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+
<!--#endif -->
24+
<!--#if (SingleFile || NativeAot)-->
25+
26+
<!-- Set up the MCP server to be a single file executable -->
27+
<PublishSingleFile>true</PublishSingleFile>
28+
<!--#endif -->
29+
<!--#if (NativeAot)-->
30+
31+
<!-- Configure the MCP server to be a native AOT application with invariant globalization -->
32+
<PublishAot>true</PublishAot>
33+
<InvariantGlobalization>true</InvariantGlobalization>
34+
<!--#endif -->
1335

1436
<!-- Set recommended package metadata -->
1537
<PackageReadmeFile>README.md</PackageReadmeFile>

0 commit comments

Comments
 (0)