dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.83k stars 457 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.' #4235

Closed v-reinawang closed 4 months ago

v-reinawang commented 5 months ago

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU

  2. Install VS 17.10 GA FB

    • Web workload
    • Includes Aspire 8.0.0
  3. Install Aspire 8.0.1 workload

    • Apply feed for Aspire 8.0.1

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. Select 8.0.1 resource in the Package source drop-down box > Select all packages > Update image

  4. Right click the solution > Build and F5

NOTE: If right click the solution > Rebuild solution, this project can be run successfully

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.

v-elenafeng commented 5 months ago

@joperezr @vijayrkn FYI on this issue that was reported for updating solution from 8.0.0 to 8.0.1.

joperezr commented 5 months ago

From the repro steps, it isn't clear to me if the project was restored after updating packages. The issue seems like something that would happen if full restore didn't happen.

v-reinawang commented 5 months ago
  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.
balachir commented 4 months ago

@BillHiebert @vijayrkn should we open an issue on VS tooling for this? I'd expect that updating NuGet packages and doing a build should trigger a restore when needed, no?

cc: @joperezr @v-reinawang

balachir commented 4 months ago

@BillHiebert @vijayrkn https://github.com/dotnet/aspire/issues/4310 is a similar issue where the user needs to do a full clean and rebuild after updating their packages from Aspire 8.0.1 to Aspire 8.1.

v-elenafeng commented 4 months ago

@BillHiebert @vijayrkn #4310 is a similar issue where the user needs to do a full clean and rebuild after updating their packages from Aspire 8.0.1 to Aspire 8.1.

4310 occurs when opening existing Aspire 8.0.1 apps without updating the packages to Aspire 8.1.

BillHiebert commented 4 months ago

@balachir build and restore is orchestrated by the managed project system. I would open an issue there https://github.com/dotnet/project-system

v-reinawang commented 4 months ago

I opened a new issue #9489 in https://github.com/dotnet/project-system

drewnoakes commented 4 months ago

This might not be Aspire-specific. It seems like an instance of https://github.com/dotnet/project-system/issues/8014. We will investigate on the Project System side.