|
10 | 10 |
|
11 | 11 | set -e
|
12 | 12 |
|
| 13 | +# Set the current latest Aspire version here |
| 14 | +ASPIRE_LATEST_VERSION="9.4.0" |
| 15 | + |
13 | 16 | # default to latest if not specified
|
14 | 17 | VERSION="${VERSION:-"latest"}"
|
| 18 | +INSTALL_CLI="${INSTALLCLI:-"true"}" |
15 | 19 |
|
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'." |
18 | 23 | exit 1
|
19 | 24 | fi
|
20 | 25 |
|
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" |
23 | 29 | fi
|
24 | 30 |
|
25 | 31 | echo "Activating feature '.NET Aspire' version: $VERSION"
|
26 | 32 |
|
27 | 33 | # Before .NET Aspire 9.1 install required `dotnet workload`: this is no longer necessary, as Aspire is
|
28 | 34 | # installed when restoring Aspire projects. It's only necessary to install the appropriate version of the templates.
|
29 | 35 |
|
30 |
| - |
31 |
| -if [[ $VERSION =~ ^(9\.1\.0)$ ]]; then |
32 |
| - dotnet new install --force Aspire.ProjectTemplates::$VERSION |
33 |
| -else |
| 36 | +if [[ $VERSION == "latest-daily" ]]; then |
34 | 37 | # https://github.com/dotnet/aspire/blob/main/docs/using-latest-daily.md
|
35 | 38 | dotnet nuget add source --name dotnet9 https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
|
36 | 39 |
|
|
44 | 47 | # </packageSourceMapping>
|
45 | 48 |
|
46 | 49 | 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 |
47 | 58 | fi
|
48 | 59 |
|
49 | 60 | echo "... done activating feature '.NET Aspire' version: $VERSION"
|
0 commit comments