dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.37k stars 349 forks source link

Mac with Apple Silicon: The Aspire application host is not installed at /Users/<user>/.dcp/dcp #1720

Open kavatari opened 5 months ago

kavatari commented 5 months ago

The following exception pops up:

Microsoft.Extensions.Hosting.Internal.Host[11]
      Hosting failed to start
      System.IO.FileNotFoundException: The Aspire application host is not installed at "/Users/<user>/.dcp/dcp". The application cannot be run without it.
      File name: '/Users/<user>/.dcp/dcp'
         at Aspire.Hosting.Dcp.DcpHostService.CreateDcpProcessSpec(Locations locations) in /_/src/Aspire.Hosting/Dcp/DcpHostService.cs:line 161
         at Aspire.Hosting.Dcp.DcpHostService.EnsureDcpHostRunning() in /_/src/Aspire.Hosting/Dcp/DcpHostService.cs:line 125
         at Aspire.Hosting.Dcp.DcpHostService.StartAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpHostService.cs:line 82
         at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
         at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)

Do I miss some setup?

danegsta commented 5 months ago

@kavatari can you double check if you have the build property <IsAspireHost>true</IsAspireHost> set in your host .csproj? That property is required to activate the Aspire workload for the host project (and the workload not loading is the most likely thing that could cause that particular error).

kavatari commented 5 months ago

@danegsta thanks for the hint, I totally forgot about this one. I added the property, now there is an other error:

Build with surface heuristics started at 18:54:39
Use build tool: /opt/homebrew/Cellar/dotnet/8.0.1/libexec/sdk/8.0.101/MSBuild.dll
CONSOLE: MSBuild version 17.8.3+195e7f5a3 for .NET
CONSOLE: Build started 20.01.2024 18:54:39.
CONSOLE: Project "/var/folders/99/7ww0fhh92hx6h2kr8f0x6h9w0000gn/T/Xiwelyl.proj" on node 1 (default targets).
CONSOLE: ControllerTarget:
CONSOLE:   Run controller from /Applications/Rider.app/Contents/lib/ReSharperHost/JetBrains.Platform.MsBuildTask.v17.dll
2>------- Started building project: OneConnect.Host
2>Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): Error NETSDK1147 : To build this project, the following workloads must be installed: aspire
To install these workloads, run the following command: dotnet workload restore
2>------- Finished building project: OneConnect.Host. Succeeded: False. Errors: 1. Warnings: 0
Build completed in 00:00:00.542

I executed the following command: "botnet workload restore", but it show me still that aspire workload is not installed.

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.101

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, run 'dotnet dev-certs https --trust'
Learn about HTTPS: https://aka.ms/dotnet-https

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Installing workloads: aspire

Skipping NuGet package signature verification.
Installing workload manifest microsoft.net.sdk.aspire version 8.0.0-preview.2.23619.3...
Installing pack Aspire.Hosting.Sdk version 8.0.0-preview.1.23557.2...
Writing workload pack installation record for Aspire.Hosting.Sdk version 8.0.0-preview.1.23557.2...
Installing pack Aspire.ProjectTemplates version 8.0.0-preview.1.23557.2...
Writing workload pack installation record for Aspire.ProjectTemplates version 8.0.0-preview.1.23557.2...
Installing pack Aspire.Hosting.Orchestration.osx-arm64 version 8.0.0-preview.1.23557.2...
Writing workload pack installation record for Aspire.Hosting.Orchestration version 8.0.0-preview.1.23557.2...
Installing pack Aspire.Hosting version 8.0.0-preview.1.23557.2...
Writing workload pack installation record for Aspire.Hosting version 8.0.0-preview.1.23557.2...
Garbage collecting for SDK feature band(s) 8.0.100...
Uninstalling workload pack Aspire.Hosting version 8.0.0-preview.1.23557.2...
Uninstalling workload pack Aspire.ProjectTemplates version 8.0.0-preview.1.23557.2...
Uninstalling workload pack Aspire.Hosting.Sdk version 8.0.0-preview.1.23557.2...
Uninstalling workload pack Aspire.Hosting.Orchestration version 8.0.0-preview.1.23557.2...

Successfully installed workload(s) aspire.

Currently, I think the dotnet installation might be not ok? Got also the same error for the aspire-samples/eShopLite solution.

edit: just tested my solution on my Windows machine, works like a charm.

danegsta commented 5 months ago

@kavatari can you run dotnet —list-sdks and dotnet workload list and share the output?

kavatari commented 5 months ago

dotnet --list-sdks 8.0.101 [/opt/homebrew/Cellar/dotnet/8.0.1/libexec/sdk]

dotnet workload list is not showing any workloads installed...this will be the problem.

Installed Workload Id      Manifest Version      Installation Source
--------------------------------------------------------------------

Right now, I am curious about the following output when installing the workload for aspire. Is this a normal behaviour?

...
Garbage collecting for SDK feature band(s) 8.0.100...
Uninstalling workload pack Aspire.Hosting version 8.0.0-preview.1.23557.2...
Uninstalling workload pack Aspire.ProjectTemplates version 8.0.0-preview.1.23557.2...
Uninstalling workload pack Aspire.Hosting.Sdk version 8.0.0-preview.1.23557.2...
Uninstalling workload pack Aspire.Hosting.Orchestration version 8.0.0-preview.1.23557.2...
danegsta commented 5 months ago

I’ve got a Mac, but haven’t tried installing the SDK via homebrew on it; when I’m back in the office on Monday I’ll try it out and see if I can reproduce this workload behavior. I’m wondering if it’s an elevated vs unelevated file permission issue; homebrew usually installs applications unelevated, but most of the sdk workload commands assume they have to be run elevated. I know I’ve seen other workload install issues related to that before.

radical commented 5 months ago

Running with -v diag should give more information on what went wrong: dotnet workload restore -v diag

kavatari commented 5 months ago

@danegsta it is definitely a homebrew problem. Maybe it would be still interesting to know what has to be done for the homebrew installation.

homebrew uninstall dotnet

dotnet --list-sdks

6.0.202 [/usr/local/share/dotnet/sdk]
7.0.400 [/usr/local/share/dotnet/sdk]
8.0.100 [/usr/local/share/dotnet/sdk]

Now, .NET Aspire workload can be found and I can run my solution.

dotnet workload list 

Installed Workload Id      Manifest Version                     Installation Source
-----------------------------------------------------------------------------------
aspire                     8.0.0-preview.2.23619.3/8.0.100      SDK 8.0.100        

Use `dotnet workload search` to find additional workloads to install.
dbreshears commented 5 months ago

This is something that needs be addressed in the .NET SDK. Will need to open an issue there.