Skip to content

azd ai agent init: validate .NET runtime version against .csproj TargetFramework #8202

@v1212

Description

@v1212

Problem

When a user selects a .NET runtime version during azd ai agent init (e.g. dotnet 9), but the downloaded template's .csproj targets a different framework (e.g. net10.0), azd does not warn. The mismatch is only caught later during remote build on the server, resulting in a confusing failure.

Proposed Solution

After template download (or during from-code init), read the TargetFramework property from the .csproj file and compare it against the user-selected runtime version. If mismatched:

  • Warn the user and suggest correcting the .csproj, or
  • Auto-correct the selection to match the .csproj, or
  • Offer to update the .csproj TargetFramework to match the selected runtime

Context

  • Relevant code: cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go (already reads .csproj for AssemblyName)
  • Currently azd only extracts AssemblyName from .csproj, does not read TargetFramework

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions