Skip to content

Commit d0de05a

Browse files
Address PR feedback: use withFlagArg and always pass --force
- Use withFlagArg('--force', ...) instead of withArg('--force') as it is purpose-built for boolean flags. - Always pass force: true since the non-containerized path already prompts the user via confirmOverwriteExisting before reaching dotnet new, so --force is needed to match the confirmed intent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 367fe0f commit d0de05a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/commands/createNewProject/ProjectCreateStep/DotnetProjectCreateStep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class DotnetProjectCreateStep extends ProjectCreateStepBase {
6666
templateArgs.Framework = context.workerRuntime.targetFramework;
6767
}
6868

69-
await executeDotnetTemplateCreate(context, version, projTemplateKey, context.projectPath, identity, templateArgs, { force: !!context.containerizedProject });
69+
await executeDotnetTemplateCreate(context, version, projTemplateKey, context.projectPath, identity, templateArgs, { force: true });
7070

7171
await setLocalAppSetting(context, context.projectPath, ConnectionKey.Storage, '', MismatchBehavior.Overwrite);
7272
}

src/templates/dotnet/executeDotnetTemplateCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { randomUtils, type IActionContext } from '@microsoft/vscode-azext-utils';
7-
import { composeArgs, withArg, withNamedArg, withQuotedArg } from '@microsoft/vscode-processutils';
7+
import { composeArgs, withArg, withFlagArg, withNamedArg, withQuotedArg } from '@microsoft/vscode-processutils';
88
import * as fs from 'fs';
99
import * as os from 'os';
1010
import * as path from 'path';
@@ -103,7 +103,7 @@ export async function executeDotnetTemplateCreate(
103103
...Object.entries(templateArgs)
104104
.filter(([, value]) => value !== undefined && value !== '')
105105
.map(([key, value]) => withNamedArg(`--${key}`, value, { shouldQuote: true })),
106-
...(options?.force ? [withArg('--force')] : []),
106+
withFlagArg('--force', options?.force),
107107
)();
108108

109109
await cpUtils.executeCommand(

0 commit comments

Comments
 (0)