1- // Copyright (c) .NET Foundation. All rights reserved.
1+ // Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
44using System ;
@@ -38,12 +38,19 @@ public static IEnumerable<NuGetFramework> GetAssetFrameworks(string packageId, I
3838 var runtimeGraph = new RuntimeGraph ( ) ;
3939 var conventions = new ManagedCodeConventions ( runtimeGraph ) ;
4040
41+ var isToolOnly = packageTypes . Count == 1 &&
42+ ( packageTypes [ 0 ] == PackageType . DotnetTool ||
43+ packageTypes [ 0 ] == PackageType . DotnetCliTool ) ;
44+
45+ var isToolWithMcpServer = packageTypes . Count == 2 &&
46+ packageTypes . Contains ( PackageType . DotnetTool ) &&
47+ packageTypes . Any ( pt => pt . Name == "McpServer" ) ;
48+
4149 // Let's test for tools packages first--they're a special case
4250 var groups = new List < ContentItemGroup > ( ) ;
43- if ( packageTypes . Count == 1 && ( packageTypes [ 0 ] == PackageType . DotnetTool ||
44- packageTypes [ 0 ] == PackageType . DotnetCliTool ) )
51+ if ( isToolOnly || isToolWithMcpServer )
4552 {
46- // Only a package that is a tool package (and nothing else ) will be matched against tools pattern set
53+ // Only a package that is a tool package (or MCP server package ) will be matched against tools pattern set
4754 items . PopulateItemGroups ( conventions . Patterns . ToolsAssemblies , groups ) ;
4855 }
4956 else
@@ -153,4 +160,4 @@ public static class FrameworkGenerationDisplayNames
153160 public const string NetStandard = ".NET Standard" ;
154161 }
155162 }
156- }
163+ }
0 commit comments