Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DotnetProjectCreateStep extends ProjectCreateStepBase {
templateArgs.Framework = context.workerRuntime.targetFramework;
}

await executeDotnetTemplateCreate(context, version, projTemplateKey, context.projectPath, identity, templateArgs);
await executeDotnetTemplateCreate(context, version, projTemplateKey, context.projectPath, identity, templateArgs, { force: !!context.containerizedProject });
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the non-containerized path, confirmOverwriteExisting prompts the user about overwriting existing files, but the subsequent dotnet new invocation will still refuse to overwrite on collisions unless --force is passed. Since executeDotnetTemplateCreate now supports force, consider wiring the prompt result (or presence of conflicts) into this call so the UX matches the actual behavior (or otherwise clarify that the prompt is informational only).

Copilot uses AI. Check for mistakes.

await setLocalAppSetting(context, context.projectPath, ConnectionKey.Storage, '', MismatchBehavior.Overwrite);
}
Expand Down
2 changes: 2 additions & 0 deletions src/templates/dotnet/executeDotnetTemplateCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export async function executeDotnetTemplateCreate(
workingDirectory: string | undefined,
identity: string,
templateArgs: Record<string, string>,
options?: { force?: boolean },
): Promise<void> {
const templateDir = getDotnetTemplateDir(context, version, projTemplateKey);
const itemNupkg = path.join(templateDir, itemNupkgFileName);
Expand Down Expand Up @@ -102,6 +103,7 @@ export async function executeDotnetTemplateCreate(
...Object.entries(templateArgs)
.filter(([, value]) => value !== undefined && value !== '')
.map(([key, value]) => withNamedArg(`--${key}`, value, { shouldQuote: true })),
...(options?.force ? [withArg('--force')] : []),
Comment thread
alexweininger marked this conversation as resolved.
Outdated
)();

await cpUtils.executeCommand(
Expand Down
Loading