Skip to content

Commit 2823f9b

Browse files
authored
Merge pull request #10 from aaronpowell/supporting-cli
Adding support to install Aspire CLI
2 parents b6a7d63 + 5de2c1a commit 2823f9b

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

src/dotnetaspire/devcontainer-feature.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "dotnetaspire",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"name": ".NET Aspire",
55
"documentationURL": "https://github.com/dotnet/aspire-devcontainer-feature",
66
"description": "Installs Aspire. See https://aka.ms/dotnetaspire",
@@ -10,11 +10,16 @@
1010
"proposals": [
1111
"latest daily",
1212
"latest",
13-
"9.3",
13+
"9.3"
1414
],
1515
"default": "latest",
1616
"description": "Select or enter an Aspire version. Use 'latest' for the latest supported version, '9.3.1' for the 9.3.1 version, 'X.Y' or 'X.Y.Z' for a specific version, or 'latest-daily' for the latest unsupported build."
1717
},
18+
"installCli": {
19+
"type": "boolean",
20+
"default": true,
21+
"description": "Whether to install the Aspire CLI."
22+
}
1823
},
1924
"customizations": {
2025
"vscode": {
@@ -38,4 +43,4 @@
3843
"version": "latest"
3944
}
4045
}
41-
}
46+
}

src/dotnetaspire/install.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,30 @@
1010

1111
set -e
1212

13+
# Set the current latest Aspire version here
14+
ASPIRE_LATEST_VERSION="9.4.0"
15+
1316
# default to latest if not specified
1417
VERSION="${VERSION:-"latest"}"
18+
INSTALL_CLI="${INSTALLCLI:-"true"}"
1519

16-
if [[ ! $VERSION =~ ^(9\.1|latest|latest-daily)$ ]]; then
17-
echo "Error: VERSION must be either '9.1', '9.1.0', 'latest', or 'latest-daily' not: '$VERSION'."
20+
# Acceptable versions: 9.x, 9.x.x, latest, latest-daily
21+
if [[ ! $VERSION =~ ^(9\.[0-9]+(\.[0-9]+)?|latest|latest-daily)$ ]]; then
22+
echo "Error: VERSION must be a valid Aspire 9.x version (e.g., '9.1', '9.2.1'), 'latest', or 'latest-daily', not: '$VERSION'."
1823
exit 1
1924
fi
2025

21-
if [[ $VERSION =~ ^(9\.1|9\.1\.0|latest)$ ]]; then
22-
VERSION="9.1.0"
26+
# Map 'latest' to the current latest version
27+
if [[ $VERSION == "latest" ]]; then
28+
VERSION="$ASPIRE_LATEST_VERSION"
2329
fi
2430

2531
echo "Activating feature '.NET Aspire' version: $VERSION"
2632

2733
# Before .NET Aspire 9.1 install required `dotnet workload`: this is no longer necessary, as Aspire is
2834
# installed when restoring Aspire projects. It's only necessary to install the appropriate version of the templates.
2935

30-
31-
if [[ $VERSION =~ ^(9\.1\.0)$ ]]; then
32-
dotnet new install --force Aspire.ProjectTemplates::$VERSION
33-
else
36+
if [[ $VERSION == "latest-daily" ]]; then
3437
# https://github.com/dotnet/aspire/blob/main/docs/using-latest-daily.md
3538
dotnet nuget add source --name dotnet9 https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
3639

@@ -44,6 +47,14 @@ else
4447
# </packageSourceMapping>
4548

4649
dotnet new install Aspire.ProjectTemplates::*-* --force
50+
else
51+
dotnet new install --force Aspire.ProjectTemplates::$VERSION
52+
fi
53+
54+
# Optionally install the Aspire CLI if requested
55+
if [[ "${INSTALL_CLI,,}" == "true" ]]; then
56+
echo "Installing Aspire CLI (prerelease)..."
57+
curl -sSL https://aspire.dev/install.sh | bash
4758
fi
4859

4960
echo "... done activating feature '.NET Aspire' version: $VERSION"

0 commit comments

Comments
 (0)