Skip to content

Add VS Code workspace recommendations and launch config to aspire new templates#15532

Open
adamint wants to merge 5 commits intomainfrom
dev/adamint/extension-rec-template
Open

Add VS Code workspace recommendations and launch config to aspire new templates#15532
adamint wants to merge 5 commits intomainfrom
dev/adamint/extension-rec-template

Conversation

@adamint
Copy link
Member

@adamint adamint commented Mar 24, 2026

Description

After aspire new successfully creates a project from any template, the CLI now generates .vscode/extensions.json and .vscode/launch.json in the output directory if they don't already exist.

  • extensions.json: Recommends the microsoft-aspire.aspire-vscode extension as a workspace recommendation
  • launch.json: Provides a default "Aspire: Launch default apphost" debug configuration so users can immediately F5

Existing files are preserved — if either file already exists, it is not overwritten.

Fixes #14802
Fixes #14391

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

After successful template creation, aspire new now generates
.vscode/extensions.json (recommending the Aspire extension) and
.vscode/launch.json (default Aspire debug configuration). Existing
files are not overwritten.

Fixes #14802
Fixes #14391
Copilot AI review requested due to automatic review settings March 24, 2026 16:21
@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15532

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15532"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds post-template scaffolding to aspire new so newly created projects are immediately VS Code-ready (workspace extension recommendation + default Aspire debug configuration), while preserving any existing workspace files.

Changes:

  • Generate .vscode/extensions.json recommending microsoft-aspire.aspire-vscode when missing.
  • Generate .vscode/launch.json with the default “Aspire: Launch default apphost” configuration when missing.
  • Add CLI tests validating file creation and non-overwrite behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Aspire.Cli/Commands/NewCommand.cs Writes VS Code workspace files after successful template creation (without overwriting existing files).
tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs Adds tests for creating VS Code workspace files and ensuring existing files aren’t overwritten.

@github-actions
Copy link
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 2 jobs were identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

We make the assumption that the output path is the root of the workspace, but I think that is probably fine for now. No plans to add it to the recommended extensions if the file already exists?

@JamesNK
Copy link
Member

JamesNK commented Mar 25, 2026

What happens if someone isn't using vscode? How come adding this file is an extra step and not part of the other file creation in scaffolding?

Who is the aspire new expert who can comment on this?

adamint added 3 commits March 24, 2026 17:58
…ion-rec-template

# Conflicts:
#	src/Aspire.Cli/Commands/NewCommand.cs
…NewCommand

Add .vscode/extensions.json (recommending Aspire extension) and
.vscode/launch.json (with Aspire debug config) directly to the four
solution templates that include an AppHost:
- aspire-empty
- aspire-starter
- aspire-ts-cs-starter
- aspire-py-starter

This is better than programmatic generation because it works with all
template instantiation paths (dotnet new, aspire new, Visual Studio),
not just the Aspire CLI.

Remove WriteVsCodeWorkspaceFiles from NewCommand.cs and the three
related tests.
@github-actions
Copy link
Contributor

🎬 CLI E2E Test Recordings — 49 recordings uploaded (commit a78024d)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23520221869

@JamesNK
Copy link
Member

JamesNK commented Mar 25, 2026

@davidfowl @DamianEdwards What do you think of including vscode files in templates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants