maui: Unable to build a project with net7 RC 1

Description

Upgraded to newest VS Preview with support for maui .net 7 RC 1, but I´m unable to build the project. The output complains that workloads for IOS and MacCatalyst are missing. I repaired both, .net 7 RC1 SDK and VS but it had no effect.

Output of dotnet workload list:

Installierte Workload-ID      Manifestversion                   Installationsquelle
-----------------------------------------------------------------------------------
maui-windows                  7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
maui-maccatalyst              7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
maccatalyst                   15.4.1006-rc.1/7.0.100-rc.1       VS 17.4.32916.344
maui-ios                      7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
ios                           15.4.1006-rc.1/7.0.100-rc.1       VS 17.4.32916.344
maui-android                  7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
android                       33.0.0-rc.1.151/7.0.100-rc.1      VS 17.4.32916.344

Output VS Error View

Severity	Code	Description	Project	File	Line	Suppression State
Error	NU1012	Platform version is not present for one or more target frameworks, even though they have specified a platform: net7.0-ios, net7.0-maccatalyst	MauiApp11	C:\src\stuff\MauiApp11\MauiApp11.csproj	1	
Error	NU1012	Platform version is not present for one or more target frameworks, even though they have specified a platform: net7.0-ios, net7.0-maccatalyst	MauiApp11	C:\src\stuff\MauiApp11\MauiApp11.csproj	1	
Error	NETSDK1147	To build this project, the following workloads must be installed: maccatalyst
To install these workloads, run the following command: dotnet workload restore	MauiApp11	C:\Program Files\dotnet\sdk\7.0.100-rc.1.22431.12\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets	38	

Output dotnet workload restore

PS C:\src\stuff\MauiApp11> dotnet workload restore
Installing workloads: ios maccatalyst

Downloading Microsoft.iOS.Sdk.Msi.x64 (15.4.1006-rc.1)
Workload installation failed. Rolling back installed packs...
Downloading microsoft.net.sdk.tvos.manifest-7.0.100-rc.1.msi.x64 (15.4.1006-rc.1)
Installation rollback failed: One or more errors occurred. (microsoft.net.sdk.tvos.manifest-7.0.100-rc.1.msi.x64::15.4.1006-rc.1 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\;https://kreon.halvotec.local/Collection1/_packaging/HalvotecPackages/nuget/v3/index.json".)
Downloading microsoft.net.sdk.maccatalyst.manifest-7.0.100-rc.1.msi.x64 (15.4.1006-rc.1)
Installation rollback failed: One or more errors occurred. (microsoft.net.sdk.maccatalyst.manifest-7.0.100-rc.1.msi.x64::15.4.1006-rc.1 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\;https://kreon.halvotec.local/Collection1/_packaging/HalvotecPackages/nuget/v3/index.json".)
Downloading microsoft.net.sdk.ios.manifest-7.0.100-rc.1.msi.x64 (15.4.1006-rc.1)
Installation rollback failed: One or more errors occurred. (microsoft.net.sdk.ios.manifest-7.0.100-rc.1.msi.x64::15.4.1006-rc.1 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\;https://kreon.halvotec.local/Collection1/_packaging/HalvotecPackages/nuget/v3/index.json".)
Workload installation failed: One or more errors occurred. (microsoft.ios.sdk.msi.x64::15.4.1006-rc.1 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\;https://kreon.halvotec.local/Collection1/_packaging/HalvotecPackages/nuget/v3/index.json".)PS C:\src\stuff\MauiApp11>

Steps to Reproduce

  1. Update to newest VS preview
  2. Create a new maui project
  3. Build
  4. => Errors in Error View

Link to public reproduction project repository

why? dotnet new maui

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

doesn´t matter

Did you find any workaround?

no

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 39 (6 by maintainers)

Commits related to this issue

Most upvoted comments

We are actively investigating this issue and have an idea of the problem - basically the version generated for the .msi installer created for the packages was creating an older version than the dotnet CLI tools expect to see.

We are working on this and will be publishing updated packages to make a workaround available as quickly as we can.

Thid is still not solved

I’ve been struggling this for the past few days, but I persevered after reading some of the comments here. I got it fixed in the end, but there are clearly some bugs to be ironed out with the overall process.

Here is what I experienced: If you have the .Net 7 RC1 SDK installed, and then you install Visual Studio 17.4.0 Preview 2.1 - dotnet workload list would look something like this (note the ugly error):

Installed Workload Id      Manifest Version                  Installation Source
------------------------------------------------------------------------------------------------
ios                        15.4.1006-rc.1/7.0.100-rc.1       SDK 7.0.100-rc.1, VS 17.4.32916.344
maccatalyst                15.4.1006-rc.1/7.0.100-rc.1       SDK 7.0.100-rc.1, VS 17.4.32916.344
macos                      12.3.1029-rc.1/7.0.100-rc.1       SDK 7.0.100-rc.1
runtimes-windows           7.0.0-rtm.22471.3/7.0.100         VS 17.4.32916.344
maui-windows               7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
maui-maccatalyst           7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
maui-ios                   7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
maui-android               7.0.0-rc.1.6683/7.0.100-rc.1      VS 17.4.32916.344
android                    33.0.0-rc.1.151/7.0.100-rc.1      VS 17.4.32916.344

Use `dotnet workload search` to find additional workloads to install.

Unhandled exception: System.Collections.Generic.KeyNotFoundException: The given key 'Microsoft.iOS.Sdk' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.<>c__DisplayClass32_0.<GetUpdatedWorkloads>b__2(WorkloadPackId p)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.GetUpdatedWorkloads(WorkloadResolver advertisingManifestResolver, IEnumerable`1 installedWorkloads)+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Microsoft.DotNet.Workloads.Workload.List.WorkloadListCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Cli.Parser.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()

In the scenario above, it seems to be necesary to manually uninstall ios, maccatalyst and macos workloads like so:

dotnet workload uninstall ios
dotnet workload uninstall maccatalyst
dotnet workload uninstall macos

Once done, you can install using the command posted by @Redth earlier (with the skip signature flag enabled:

dotnet workload install maui android ios maccatalyst macos --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/net7.0-rc.1.2.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --skip-sign-check

After doing this I was able to build.

Additionally - in case it helps anyone else - I did find strange behaviour when attempting to install Visual Studio 17.4.0 Preview 2.1 without having .Net 7 RC1 installed beforehand.

In this scenario, I found that “maui” would not appear in my workload list during dotnet workload search - even when I had the “MAUI” workload checked in the VS installer.

As a result, atempting to use the suggeted fix above would not work and would display “Workload id maui is not recognized”.

Using the “Repair” tool in the Visual Studio Installer was necessary to make the “maui” workload appear. It is odd that this would be required for a ‘fresh’ install - but that was my experience.

@virzak It doesn’t seem to help me… image

We have some newer packages we will publish soon after a bit more validation.

If anyone is willing to try and install them from the staging feed, you can try the following commands:

dotnet --verson

Make sure you are running dotnet commands within the context of 7.0.100-rc.1 (ideally the exact version is 7.0.100-rc.1.22431.12)

NOTE: The context matters when you run these commands and it’s possible if you run them from a current directory that has the sdk version pinned from a global.json file, things will not run as you might be expecting. This goes for all dotnet commands!

Run the following command exactly:

dotnet workload install maui android ios maccatalyst macos --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/net7.0-rc.1.2.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json

If you try this, please report your results!

ow. Well didn’t work out that way. Now, Visual Studio does not recognize my .NET MAUI project anymore and suggests installing extra components for a full development experience instead. However, when trying to do so, it also explains that everything is already in place.

Result: My .NET MAUI setup is completely broken… 😦

What is worse, VS Preview 2.1 with installed RC1 does not allow to build 6.0 MAUI applications. I see constant error in MAUI build:

Error NETSDK1147 To build this project, the following workloads must be installed: maccatalyst To install these workloads, run the following command: dotnet workload restore SCF C:\Program Files\dotnet\sdk\6.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets 38

Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-ios, net6.0-maccatalyst

Have you ever tried VS 2022 and VS 2022 Preview installed together with both 6.0/7.0 RC1?

Can report the same, Vs 2022 is now broken too on my machine with maui 6.

What is worse, VS Preview 2.1 with installed RC1 does not allow to build 6.0 MAUI applications. I see constant error in MAUI build:

Error NETSDK1147 To build this project, the following workloads must be installed: maccatalyst To install these workloads, run the following command: dotnet workload restore SCF C:\Program Files\dotnet\sdk\6.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets 38

Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-ios, net6.0-maccatalyst

Have you ever tried VS 2022 and VS 2022 Preview installed together with both 6.0/7.0 RC1?

+1