Microsoft.Maui version 8.0.70 NuGet packages automatically switch back to 8.0.61

Kim Strasser 1,321 Reputation points
2024-07-23T20:52:20.9+00:00

I have updated the NuGet packages Microsoft.Maui.Controls, Microsoft.Maui.Controls.Compatibility and Microsoft.Maui.Essentials from version 8.0.61 to 8.0.70. Then I got the following error when I tried to build my iOS project:

Error MSB4019 The imported project "C:\Program Files\dotnet\packs\Aspire.Hosting.Sdk\8.0.2\Sdk\AutoImport.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\packs\Aspire.Hosting.Sdk\8.0.2\Sdk\AutoImport.props" is correct, and that the file exists on disk. IOSTest C:\Program Files\dotnet\sdk\8.0.303\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props

Why am I getting this error?

Then I removed my project´s bin and obj folder and opened it again in Visual Studio Community 2022 (64-bit) Version 17.10.4. Then I saw that the NuGet packages automatically switched from version 8.0.61 to 8.0.70.

Why can I not use version 8.0.70 in my iOS project?

Screenshot 2024-07-23 224934

Developer technologies | .NET | .NET MAUI
Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2024-07-24T18:04:50.28+00:00

    nuget package references are stored in the project file. you probably did not save the project file after updating the packages. so when reopened it was reverted. you should save all after updating packages. you should also delete the bin & object folders before doing a restore/build.

    I suspect your dotnet workloads need updating or are corrupt. The Maui and Aspire workloads are often problematic:

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

    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.