Workload error after update Visual Studio to 17.4.0 Preview 2.1
Asked Answered
M

5

14

Today I updated Visual Studio to 17.4.0 Preview 2.1.

Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.4.0 Preview 2.1

After that, I can't deploy my Blazor application because I got this error:

To build this project, the following workloads must be installed: wasm-tools-net6 To install these workloads, run the following command: dotnet workload restore

I ran the command but nothing changed.

enter image description here

How can I fix it?

Mansour answered 21/9, 2022 at 16:36 Comment(2)
try "dotnet workload restore --interactive"Mott
I tried this command and it installed NET7 but my application is in NET6Mansour
W
4

This was hiding other errors for me.

Still, I was forced to install the correct NET workload to discover the real errors. In my case, I was targeting NET7, so I ran the following in the Package Manager Console (from the top menu: View > Other Windows > Package Manager Console):

dotnet workload install wasm-tools-net7

just change it to net6 if you target NET6.

After that, I still was seeing the same error: enter image description here

Then, I ran Clean and then Rebuild commands (right click solution -> Clean, then Rebuild Solution). After this last step, the real errors appeared:

enter image description here

Wini answered 17/11, 2023 at 11:23 Comment(0)
A
2

I just ran into this problem as well after updating a few projects to .Net 7. I found that the problem related to the Target Framework, and Target Location of the publish profile. Once I upgraded these from .Net6 to .Net7 publishing worked again for me. enter image description here

Albano answered 23/11, 2022 at 5:26 Comment(1)
you can run this command: dotnet workload install wasm-tools-net6Gine
L
2

dotnet workload restore --interactive then restarting Visual Studio fixed it for me

Literacy answered 15/2 at 13:3 Comment(0)
I
2

I got this working by installing .NET WebAssembly Build Tools with the Visual Studio Installer:

enter image description here

Inverse answered 16/3 at 11:10 Comment(0)
D
0

For me (after trying all above answers and still having the same problem) it worked to untick the Ahead-of-time (AOT) compilation:

  1. From the main menu: Build -> Publish [myProject] -> Show all settings -> File Publish Options
  2. Untick Ahead-of-time (AOT) compilation

For me (after trying all above answers and still having the same problem) it worked to untick the Ahead-of-time (AOT) compilation:

  1. From the main menu: Build -> Publish [myProject] -> Show all settings -> File Publish Options
  2. Untick Ahead-of-time (AOT) compilation

Deviate answered 5/7 at 14:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.