dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.93k stars 480 forks source link

Can't create aspire apphost from the dotnet cli since upgrading to .net 9 #6665

Closed GrantByrn3 closed 1 week ago

GrantByrn3 commented 1 week ago

Is there an existing issue for this?

Describe the bug

Trying to add a new apphost to a new solution, but running into an error:

➜  Notifications git:(main) dotnet new aspire-apphost -o TSWCloud.NotificationService.AppHost
No templates or subcommands found matching: 'aspire-apphost'.

To list installed templates similar to 'aspire-apphost', run:
   dotnet new list aspire-apphost
To search for the templates on NuGet.org, run:
   dotnet new search aspire-apphost

For details on the exit code, refer to https://aka.ms/templating-exit-codes#103
➜  Notifications git:(main) dotnet new list aspire-apphost                                   
No templates found matching: 'aspire-apphost'.

To search for the templates on NuGet.org, run:
   dotnet new search aspire-apphost

For details on the exit code, refer to https://aka.ms/templating-exit-codes#103
➜  Notifications git:(main) dotnet new search aspire-apphost
Searching for the templates...
Matches from template source: NuGet.org
No templates found matching: 'aspire-apphost'.

For details on the exit code, refer to https://aka.ms/templating-exit-codes#103

This is one Fedora Workspace 41.

Upgraded to .net 9 via the shell script here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual Using the command ./dotnet-install.sh --channel 9.0 I've installed it this way because I'm having trouble getting the latest version via the Fedora package manager. (A bit of that saga is described here: https://github.com/dotnet/aspire/issues/5205)

Expected Behavior

It creates an apphost project for me.

Steps To Reproduce

Run the command dotnet new aspire-apphost -o TSWCloud.NotificationService.AppHost

Exceptions (if any)

No response

.NET Version info

Output of dotnet --info

➜  Notifications git:(main) dotnet --info                   
.NET SDK:
 Version:           9.0.100
 Commit:            59db016f11
 Workload version:  9.0.100-manifests.3068a692
 MSBuild version:   17.12.7+5b8665660

Runtime Environment:
 OS Name:     fedora
 OS Version:  41
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/grant/.dotnet/sdk/9.0.100/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  8.0.303 [/home/grant/.dotnet/sdk]
  8.0.400 [/home/grant/.dotnet/sdk]
  9.0.100 [/home/grant/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.7 [/home/grant/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [/home/grant/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [/home/grant/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.7 [/home/grant/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [/home/grant/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [/home/grant/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/home/grant/.dotnet]

global.json file:
  /home/grant/Code/Notifications/global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Anything else?

No response

davidfowl commented 1 week ago

Did you install the aspire templates?

https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/aspire-sdk-templates?pivots=dotnet-cli

GrantByrn3 commented 1 week ago

@davidfowl Wow, I was being really dumb.

Didn't think that updating to dotnet 9 would require having to add the templates.

Makes sense in retrospective.

➜  dotnet new install Aspire.ProjectTemplates
The following template packages will be installed:
   Aspire.ProjectTemplates

Installing the template package(s) will override the available template package(s).
The following template package(s) are already available:
   Aspire.ProjectTemplates::8.2.2

To install the template package(s) anyway, apply '--force' option:
   dotnet new install Aspire.ProjectTemplates --force

For details on the exit code, refer to https://aka.ms/templating-exit-codes#106
➜  dotnet new list aspire
These templates matched your input: 'aspire'

Template Name                      Short Name              Language  Tags                                                   
---------------------------------  ----------------------  --------  -------------------------------------------------------
.NET Aspire App Host               aspire-apphost          [C#]      Common/.NET Aspire/Cloud                               
.NET Aspire Empty App              aspire                  [C#]      Common/.NET Aspire/Cloud/Web/Web API/API/Service       
.NET Aspire Service Defaults       aspire-servicedefaults  [C#]      Common/.NET Aspire/Cloud/Web/Web API/API/Service       
.NET Aspire Starter App            aspire-starter          [C#]      Common/.NET Aspire/Blazor/Web/Web API/API/Service/Cloud
.NET Aspire Test Project (MSTest)  aspire-mstest           [C#]      Common/.NET Aspire/Cloud/Web/Web API/API/Service/Test  
.NET Aspire Test Project (NUnit)   aspire-nunit            [C#]      Common/.NET Aspire/Cloud/Web/Web API/API/Service/Test  
.NET Aspire Test Project (xUnit)   aspire-xunit            [C#]      Common/.NET Aspire/Cloud/Web/Web API/API/Service/Test 

➜  Code mkdir aspire-test  
➜  Code cd aspire-test
➜  aspire-test dotnet new aspire-starter -o test.apphost                        
The template ".NET Aspire Starter App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/dotnet/aspire/8.0-third-party-notices for details.

Processing post-creation actions...
Restoring /home/grant/Code/aspire-test/test.apphost/test.apphost.sln:
Restore succeeded.
Restoring /home/grant/Code/aspire-test/test.apphost/test.apphost.AppHost/test.apphost.AppHost.csproj:
Restore succeeded.
Restoring /home/grant/Code/aspire-test/test.apphost/test.apphost.ServiceDefaults/test.apphost.ServiceDefaults.csproj:
Restore succeeded.
Restoring /home/grant/Code/aspire-test/test.apphost/test.apphost.ApiService/test.apphost.ApiService.csproj:
Restore succeeded.
Restoring /home/grant/Code/aspire-test/test.apphost/test.apphost.Web/test.apphost.Web.csproj:
Restore succeeded.

➜  aspire-test 
davidfowl commented 1 week ago

The aspire templates are not part of the .NET sdk as yet