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
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
TargetFrameworkproperty from the .csproj file and compare it against the user-selected runtime version. If mismatched:Context
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go(already reads .csproj for AssemblyName)AssemblyNamefrom .csproj, does not readTargetFramework