Update Workload Problem/ NuGet Package unable to be installed.

Muhammad Ghozlan 5 Reputation points
2024-05-10T04:54:17.63+00:00

**I have created 3 Projects:

  1. FrontEndProject and it is a Blazor Project and this is the csProj:**
    <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>

<TargetFramework>net7.0</TargetFramework>

<Nullable>enable</Nullable>

<ImplicitUsings>enable</ImplicitUsings>
```  </PropertyGroup>

  <ItemGroup>

<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.16" />

<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.16" PrivateAssets="all" />


</Project>

**2) TraditionalProject (API Project):**  
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>

<TargetFramework>net6.0</TargetFramework>

<Nullable>enable</Nullable>

<ImplicitUsings>enable</ImplicitUsings>


  <ItemGroup>

<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />


</Project>

**3) AspireApplication:**

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>

<OutputType>Exe</OutputType>

<TargetFramework>net8.0</TargetFramework>

<ImplicitUsings>enable</ImplicitUsings>

<Nullable>enable</Nullable>

<IsAspireHost>true</IsAspireHost>

<UserSecretsId>4e304158-cb25-47d7-86fd-457416df5962</UserSecretsId>


  <ItemGroup>

<PackageReference Include="Aspire.Hosting.AppHost" Version="8.0.0-preview.6.24214.1" /> <PackageReference Include="Microsoft.Maui.Graphics" Version="8.0.3" />


</Project>

I am trying to update the workload using this command:  
"dotnet workload update"  
and I am getting this:  
*Workload update failed: One or more errors occurred. (Version 8.0.21 of package microsoft.maui.graphics.win2d.winui.desktop.msi.x64 is not found in NuGet feeds [https://api.nuget.org/v3/index.json;C:\Program]() Files (x86)\Microsoft SDKs\NuGetPackages\".)*  
  
I have tried these approaches:  
1)  dotnet nuget update source nuget.org. then: dotnet nuget locals all --clear  
  
2) installing *microsoft.maui.graphics.win2d.winui.desktop.msi.x64* and I always get this no matter what version I try (I tried them all):  
*Severity Code Description Project File Line Suppression State Details 1) Error Package 'Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.Msi.x64 8.0.7' has a package type 'DotnetPlatform' that is not supported by project 'WeatherApp.Aspire.ServiceDefaults'. 2) Severity Code Description Project File Line Suppression State Details Error NU1213 The package Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.Msi.x64 8.0.7 has a package type DotnetPlatform that is incompatible with this project. WeatherApp.Aspire.ServiceDefaults*  
  
3)Adding this to the itemGroup:  
<FrameworkReference Include="Microsoft.WindowsDesktop.App.Wpf" />  
  
and none of these approaches worked.

Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET Blazor
Developer technologies C#
{count} vote

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-05-11T16:53:56.56+00:00

    Dotnet workload updates update the installed sdks, tools and templates for dotnet. They make no changes to a project file or impact nuget.

    your workload update error means you have a bad workload manifest file. In your case one of the Maui manifest files. Repairing a workload can be difficult. But start here:

    https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-workload-repair

    Note: to fix my update error (it was also related to Maui), I ended up having to delete the offending manifest file and reinstall the workload.


  2. Anonymous
    2024-05-13T06:23:41.8366667+00:00

    Hi @Muhammad Ghozlan,

    One or more errors occurred. (Version 8.0.21 of package microsoft.maui.graphics.win2d.winui.desktop.msi.x64 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages".)

    For this error message, I think you may try:

    1. Add nuget.org as source
    dotnet nuget add source "https://api.nuget.org/v3/index.json" --name "nuget.org"
    
    1. Verify that this source was added:
    dotnet nuget list source
    

    For further updated issue which is related to MAUI error message, I think you can follow the steps in this case.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Best regards,
    Rena

    0 comments No comments

  3. Pavel Voronin 5 Reputation points
    2024-05-13T20:15:22.7133333+00:00

    Same issue here

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.