microsoft / microsoft/aspire

Preserve argument escaping in DotNetNewCommand

Open
#19,298 1 comment 0 reactions 0 assignees View on GitHub
area-templates triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

`DotNetNewCommand.GetFullArgs` currently builds the command line with `string.Join(" ", args)` so it can omit `DefaultBuildArgs`, which `dotnet new` would incorrectly interpret as template options. Joining raw arguments can break values that contain spaces or require escaping, such as output paths or values containing quotes, and may behave differently across platforms.

### Describe the solution you'd like

Update the command infrastructure so `DotNetNewCommand` preserves per-argument quoting and escaping while still excluding `DefaultBuildArgs`. Prefer an `ArgumentList`-based helper or reuse the base argument-formatting behavior with an explicit way to suppress the build arguments. Add coverage for arguments containing spaces and quotes.

### Additional context

Tracked from the suggestion in https://github.com/microsoft/aspire/pull/19294#discussion_r3769021671.

Contributor guide

Open the contributing guide

Research direction

Start at DotNetNewCommand.GetFullArgs and inspect the existing command argument-formatting behavior or ArgumentList helper. Add coverage for arguments containing spaces and quotes, while confirming DefaultBuildArgs are excluded. Done means dotnet new receives correctly escaped per-argument values across platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.