Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

joelverhagen
Copy link
Member

@joelverhagen joelverhagen commented Jul 16, 2025

MCP Servers built with preview .NET SDK 6 and 7 are currently stamped with a .NET 10 preview runtime requirement. This is okay for a given SDK+runtime version but is painful when the next preview or GA come out because they are different runtime versions. In other words, .NET 10 Preview 6 runtime is a different runtime version from Preview 7 and from .NET 10.0.0 (stable version, starting with RC1).

This PR also bumps to the latest version on Microsoft.Extensions.Hosting, which is compatible with .NET 8.

This PR makes it so the MCP servers are stamped with a .NET 8 or newer (preferring .NET 8 if present) runtime requirement.

OLD <assembly name>.runtimeconfig.json file put in the .nupkg (problematic):

{
  "runtimeOptions": {
    "tfm": "net10.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "10.0.0-preview.6.25326.107"
    },
    "configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

NEW <assembly name>.runtimeconfig.json file (better):

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "rollForward": "Major",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.0"
    },
    "configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 15:55
@joelverhagen joelverhagen requested a review from a team as a code owner July 16, 2025 15:55
@github-actions github-actions bot added the area-ai-templates Microsoft.Extensions.AI.Templates label Jul 16, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the MCP server templates to require .NET 8 or newer at runtime and bumps the hosting package preview version.

  • Changed C# templates and snapshots to target net8.0 and added a RollForward policy.
  • Updated GeneratedContent.targets to use Microsoft.Extensions.Hosting preview 6.
  • Refreshed integration test snapshots to match the new template outputs.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/mcpserver.Basic.verified/mcpserver/mcpserver.csproj Updated target framework to net8.0 and added <RollForward>LatestMajor</RollForward> in the snapshot
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/McpServer/McpServer-CSharp/McpServer-CSharp.csproj.in Changed TargetFramework to net8.0 and added <RollForward>LatestMajor</RollForward> in the C# template input
src/ProjectTemplates/GeneratedContent.targets Bumped <TemplatePackageVersion_MicrosoftExtensionsHosting> to 10.0.0-preview.6.25358.103
Comments suppressed due to low confidence (2)

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

  • [nitpick] Consider adding or updating an integration test to verify that the generated runtimeconfig.json for net8.0 templates includes the RollForward setting.
    <RollForward>LatestMajor</RollForward>

src/ProjectTemplates/GeneratedContent.targets:38

  • [nitpick] Consider centralizing template package version definitions or using a shared MSBuild property so you only need to bump the version in one place.
      <TemplatePackageVersion_MicrosoftExtensionsHosting>10.0.0-preview.6.25358.103</TemplatePackageVersion_MicrosoftExtensionsHosting>

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me once the <RollForward>Major</Rollforward> change is pushed.

@joelverhagen
Copy link
Member Author

Looks good to me once the <RollForward>Major</Rollforward> change is pushed.

Oops, push was hung. Done.

@jeffhandley jeffhandley merged commit ed4aeac into main Jul 16, 2025
6 checks passed
@jeffhandley jeffhandley deleted the jver/doh branch July 16, 2025 17:34
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull request Jul 16, 2025
* Target .NET 8 for more stable runtime requirement

* Address comment
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull request Jul 16, 2025
* Target .NET 8 for more stable runtime requirement

* Address comment
jeffhandley pushed a commit to jeffhandley/extensions that referenced this pull request Jul 16, 2025
* Target .NET 8 for more stable runtime requirement

* Address comment
jeffhandley pushed a commit that referenced this pull request Jul 16, 2025
* Target .NET 8 for more stable runtime requirement

* Address comment
This was referenced Aug 15, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ai-templates Microsoft.Extensions.AI.Templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants