dotnet / project-system

The .NET Project System for Visual Studio
MIT License
967 stars 386 forks source link

[WebToolsE2E][Aspire] Updated Aspire version from 8.0.0 to 8.0.1. When running the project, an exception occurred: System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.ServiceDiscovery, Version=8.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.' #9489

Open v-reinawang opened 3 months ago

v-reinawang commented 3 months ago

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10.3
    • Web workload
    • Includes Aspire 8.0.0
  3. Install Aspire 8.0.1 workload

REPRO STEPS

  1. Open an existing 8.0.0 solutions (Aspire Starter Application), build and run - works
  2. Right click Solution > Manage NuGet Packages for Solution > Update
  3. Updated the versions of packages Aspire.Hosting.AppHost and Microsoft.Extensions.ServiceDiscovery to 8.0.1
  4. Right click the solution > Build and F5

NOTE:

  1. If you don't build and run in the first step, this issue will not be reproduced.
  2. I updated a project with 8.0.0-preview.7.24251.11 to 8.0.0, this issue is not reproduced.
  3. Execute all REPRO STEPS in CMD. This issue is not reproduced.
  4. After updating the package, wait for all packages to be restored and build successfully, then press F5, and you will encounter this issue. However, Rebuild solution will not encounter this issue.

ACTUAL System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'Microsoft.Extensions.ServiceDiscovery, Version=8.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. Source=AspireApp1.ServiceDefaults StackTrace: at Microsoft.Extensions.Hosting.Extensions.AddServiceDefaults(IHostApplicationBuilder builder) in C:\Users\v-reinawang\Desktop\AspireApp1\AspireApp1\AspireApp1.ServiceDefaults\Extensions.cs:line 35 at Program.

$(String[] args) in C:\Users\v-reinawang\Desktop\AspireApp1\AspireApp1\AspireApp1.ApiService\Program.cs:line 4 image

EXPECTED Can run successfully.

drewnoakes commented 3 months ago

This might possibly be a symptom of https://github.com/dotnet/project-system/issues/8014

Rita003 commented 2 months ago

This issue also repro when the Aspire version is upgraded from 8.0.2 to 8.1 and run the project.

AndiRudi commented 1 month ago

I just updated my Project from to 8.1.0 to 8.2.0 and now I have this error as well. I have 4 projects and when deployed to Azure all 4 throw those errors... Is there a workaround? )I tried cleaning the solution and then azd down and azd up but nothing fixes the errors)

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.ServiceDiscovery, Version=8.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Aspire.Npgsql.EntityFrameworkCore.PostgreSQL, Version=8.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

v-reinawang commented 4 weeks ago

I tried to update the project from aspire 8.1.0 to aspire 8.2.0 (updating the versions of packages Aspire.Hosting.AppHost and Microsoft.Extensions.ServiceDiscovery from 8.1.0 to 8.2.0, and updating the version of Microsoft.Extensions.Http.Resilience from 8.7.0 to 8.8.0), and both running and publishing were successful.

AndiRudi commented 4 weeks ago

After removing all bin and obj folders and restoring and deploying again it's working again. Something was weird there, but for me its fine now

v-reinawang commented 3 weeks ago

I tried to update the project from aspire 8.2.0 to aspire 9.0 (updated versions of Aspire.Hosting.AppHost and Microsoft.Extensions.ServiceDiscovery), this issue still repro.