-
Notifications
You must be signed in to change notification settings - Fork 5
Fix .NET runtime version mismatched (.NET 9 support, safer runtime detection)) #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
DotNetProjectHelperto 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
DotNetSdkVersionMismatchExceptionto 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 |
src/Microsoft.Agents.A365.DevTools.Cli/Services/Helpers/DotNetProjectHelper.cs
Show resolved
Hide resolved
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Helpers/DotNetProjectHelperTests.cs
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Exceptions/DotNetSdkVersionMismatchException.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupSubcommands/InfrastructureSubcommand.cs
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupSubcommands/InfrastructureSubcommand.cs
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Services/Helpers/DotNetProjectHelper.cs
Outdated
Show resolved
Hide resolved
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Helpers/DotNetProjectHelperTests.cs
Show resolved
Hide resolved
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Helpers/DotNetProjectHelperTests.cs
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.Cli/Services/Helpers/DotNetProjectHelper.cs
Show resolved
Hide resolved
There was a problem hiding this 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.
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