Upgrading "aspire" workload causes builds to fail until Visual Studio is restarted
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
I had a solution open in Visual Studio 2022 when I ran "dotnet workload update" on the command line, which upgraded the "aspire" workload from 8.0.1 to 8.0.2. After this, when I tried to build a project in Visual Studio, it failed with an error saying that Microsoft.NET.Sdk.ImportWorkloads.props was not able to import AutoImport.props from version 8.0.1 of Aspire.
Nothing in the solution references Aspire.
I tried to restore NuGet packages again in Visual Studio, and also with `nuget restore -force -forceEvaluate`, but it didn't help. I then restarted Visual Studio, and the build started working again.
The problem seems to be that Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.CachingWorkloadResolver assumes Visual Studio will be restarted when workloads are updated. The "dotnet workload update" command did not restart Visual Studio and did not tell me to restart it.
### To Reproduce
I can't reproduce it now, as I can't figure out how to reinstall version 8.0.1 of the "aspire" workload for .NET SDK 8.
This may be related to me having installed .NET SDK 8 and the "aspire" workload long before I installed Visual Studio 2022.
### Exceptions (if any)
I lost the error message.
### Further technical details
As I've uninstalled and reinstalled various SDK versions and workloads while trying to reproduce the error, the following output of `dotnet --info` no longer matches what it would have been when the error occurred. In particular, I don't think the "Installation Source" of "aspire" would have been VS.
```
$ dotnet --info
.NET SDK:
Version: 8.0.302
Commit: ef14e02af8
Workload version: 8.0.300-manifests.ca8b4b2d
MSBuild version: 17.10.4+10fbfbf2e
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.302\
.NET workloads installed:
[aspire]
Installation Source: VS 17.10.35013.160
Manifest Version: 8.0.0/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json
Install Type: FileBased
Host:
Version: 9.0.0-preview.5.24306.7
Architecture: x64
Commit: a5cc707d97
.NET SDKs installed:
2.1.526 [C:\Program Files\dotnet\sdk]
6.0.423 [C:\Program Files\dotnet\sdk]
8.0.302 [C:\Program Files\dotnet\sdk]
9.0.100-preview.5.24307.3 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-preview.5.24306.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-preview.5.24306.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-preview.5.24306.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
[REDACTED]\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
Visual Studio Professional 2022 LTSC 17.10 on Windows 10 x64.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.