Skip to content

Conversation

@mengyimicro
Copy link
Contributor

Summary

This PR fixes runtime-related issues in the Agent365 CLI that caused deployments to fail or provision outdated runtimes. The changes improve correctness, security defaults, and developer experience for and .NET projects.

Key Fixes

  1. Proper handling of .NET 9 projects
  • Removed the implicit assumption that all .NET apps target .NET 8.
  • CLI now detects the project’s TargetFramework / TargetFrameworks from the .csproj and:
  • Configures App Service runtime accordingly (e.g., DOTNETCORE:9.0)
  • Generates a correct Oryx manifest for .NET 9 apps
  • Prevents deployment failures when targeting .NET 9.
  1. Shared helper for .NET TFM detection
  • Introduced DotNetProjectHelper.DetectTargetRuntimeVersion as a single source of truth.
  • Used consistently across: DotNetBuilder and InfrastructureSubcommand
  • Supports: TargetFramework, TargetFrameworks and TFMs like net9.0, etc.
  1. Improved error handling for missing/incompatible .NET SDK
  • Added a structured Agent365Exception when:
  • Project targets a .NET version not installed locally
  • Fails fast with a clear, actionable message instead of a confusing dotnet publish error.
  1. Added unit tests for .NET TargetFramework detection covering:
  • net8.0
  • net9.0
  • Multiple TFMs (net8.0;net9.0)
  • Missing TargetFramework

@mengyimicro mengyimicro requested a review from a team as a code owner December 22, 2025 23:19
Copilot AI review requested due to automatic review settings December 22, 2025 23:19
@mengyimicro mengyimicro requested a review from a team as a code owner December 22, 2025 23:19
Copy link
Contributor

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 enhances the Agent365 CLI to properly detect and configure .NET runtime versions, particularly adding support for .NET 9. Previously, the CLI assumed all .NET projects targeted .NET 8, which caused deployment failures for .NET 9 projects. The changes introduce a centralized helper for detecting TargetFramework from .csproj files, update infrastructure provisioning to use the detected version, and add SDK version validation with structured error messages.

Key Changes:

  • Introduced DotNetProjectHelper to extract .NET runtime version from project files using regex parsing of TargetFramework/TargetFrameworks
  • Updated infrastructure setup to dynamically detect and configure the correct App Service runtime (e.g., DOTNETCORE:9.0 vs DOTNETCORE:8.0)
  • Added SDK version validation with a new DotNetSdkVersionMismatchException to provide actionable error messages when the required .NET SDK is not installed

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
DotNetProjectHelper.cs New helper class that parses .csproj files to extract .NET runtime version from TargetFramework elements
DotNetProjectHelperTests.cs Unit tests covering .NET 8, .NET 9, multiple TFMs, and missing TargetFramework scenarios
DotNetBuilder.cs Refactored to use new DotNetProjectHelper for version detection in Oryx manifest generation
InfrastructureSubcommand.cs Added runtime version detection logic for App Service configuration and SDK validation
DotNetSdkVersionMismatchException.cs New structured exception for SDK version mismatch errors with actionable mitigation steps
ErrorCodes.cs Added DOTNET_SDK_VERSION_MISMATCH error code constant

sellakumaran
sellakumaran previously approved these changes Dec 22, 2025
Copilot AI review requested due to automatic review settings December 22, 2025 23:59
Copy link
Contributor

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

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

@mengyimicro mengyimicro merged commit ea33b41 into main Dec 23, 2025
11 checks passed
@mengyimicro mengyimicro deleted the users/mengyixu/FixDotNetVersionMismatched branch December 23, 2025 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SDW} The A365 expects .net version 8 and fails if the service is using version 9

4 participants