dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22k stars 1.72k forks source link

Unable to build a project with net7 RC 1 #10234

Closed florianwachs closed 1 year ago

florianwachs commented 1 year ago

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

Conbag93 commented 1 year ago

+1 for this - I also have the same issue.

I also tried completely removing Visual Studio 2022 Preview and doing a fresh install. Doing this resulted in losing all of the MAUI + Blazor Hybrid project templates from the "File -> New Project" dialog. And yes - I do have the MAUI workload installed in the Visual Studio installer.

It appears that the required workloads are not installed when you download visual studio. Additionally, they cannot be found on nuget when attempting to use dotnet workload restore.

Steps to reproduce would be:

For me, the output of dotnet workload list is:

Installed Workload Id      Manifest Version                 Installation Source
-------------------------------------------------------------------------------
wasm-tools                 7.0.0-rc.1.22426.10/7.0.100      SDK 7.0.100-rc.1
runtimes-windows           7.0.0-rc.1.22426.10/7.0.100      VS 17.4.32916.344
maccatalyst                15.4.1006-rc.1/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

dotnet workload search is:

Workload ID                Description
----------------------------------------------------------------------------------------------
ios                        .NET SDK Workload for building iOS applications.
maccatalyst                .NET SDK Workload for building macOS applications with MacCatalyst.
runtimes-windows           workloads/runtimes-windows/description
runtimes-windows-net6      workloads/runtimes-windows-net6/description
tvos                       .NET SDK Workload for building tvOS applications.
wasm-experimental          workloads/wasm-experimental/description
wasm-tools                 .NET WebAssembly build tools
wasm-tools-net6            .NET WebAssembly build tools

Notably, there is no maui workload like there is in previous versions.

yiszza commented 1 year ago

+1

neoayi commented 1 year ago

+1

migueBarrera commented 1 year ago

Same issue

davefxy commented 1 year ago

Can build with net7-android only.. Cant run net6 builds. Microsoft.Maui.Dependencies (6.0.540) wont load.

virzak commented 1 year ago

This workaround helps getting the workloads

dotnet workload restore --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json
codemonkey85 commented 1 year ago

@virzak It doesn't seem to help me... image

davefxy commented 1 year ago

@virzak Didnt help me either

virzak commented 1 year ago

Same here actually. It helped download ios stuff but then started throwing.

🚀  dotnet workload restore
Installing workloads: maui-android maui-tizen

Workload installation failed: One or more errors occurred. (The given key 'Microsoft.iOS.Sdk' was not present in the dictionary.)
🚀  dotnet workload list

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
maui-windows               7.0.0-rc.2.6710/7.0.100-rc.1      VS 17.4.32916.344
maui-maccatalyst           7.0.0-rc.2.6710/7.0.100-rc.1      VS 17.4.32916.344
maui-ios                   7.0.0-rc.2.6710/7.0.100-rc.1      VS 17.4.32916.344
maui-android               7.0.0-rc.2.6710/7.0.100-rc.1      VS 17.4.32916.344
android                    33.0.0-rc.1.152/7.0.100-rc.1      VS 17.4.32916.344
wasm-tools                 7.0.0-rtm.22470.2/7.0.100         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()
davefxy commented 1 year ago

I see the same thing. I have a 2nd PC that I updated VS 2022 today, and I am not seeing the same problems. I am trying to determine the differences. The working PC doesnt get the errors shown above with "dotnet workload list"

Redth commented 1 year ago

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.

florianwachs commented 1 year ago

Great! can't wait to try it

foximoxi commented 1 year ago

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?

SunshineSpring666 commented 1 year ago

Tested on latest VS Preview 2.1, it works ok on Windows. Note the Windows SDK Build Tool NuGet Package is also updated to the latest preview version (skipping the constraint shown in Nuget package installer by installing via dotnet CLI command), hope this constraint to 22000 version can be removed officially.

SunshineSpring666 commented 1 year ago

Hi @Redth, When targeting to .NET 7 runtime, MAUI project automatically installs many Xamarin-related NuGet Packages, including: Xamarin.AndroidX.Browser, Xamarin.Android.Legacy.Support.V4, etc. See the attached image for details. MAUI_AddedXamarinNugetPackages

SunshineSpring666 commented 1 year ago

"Implicit Referenced By SDK", can't be removed. Quite weird, since this is a MAUI project.

ImplicitReferenceBySDK

florianwachs commented 1 year ago

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.

ylatuya commented 1 year ago

I can reproduce the same issue in macOS with the following versions installed in case it helps

Visual Studio Community 2022 for Mac
Version 17.3.1 (build 411)
Installation UUID: 2c9e78e1-f55b-4a36-a506-500d22d2c2f5

Runtime
.NET 6.0.5 (64-bit)
Architecture: X64

Roslyn (Language Service)
4.3.0-3.22312.2+52adfb8b2dc71ed4278debcf13960f2116868608

NuGet
Version: 6.2.1.2

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Versions:
    6.0.400
    6.0.302
    6.0.300
    6.0.101
    5.0.408
    5.0.404
    5.0.403
    5.0.402
    5.0.400
    5.0.302
    5.0.203
    5.0.202
    5.0.201
    5.0.103
    5.0.102
    5.0.100
    3.1.422
    3.1.421
    3.1.419
    3.1.416
    3.1.415
    3.1.414
    3.1.412
    3.1.411
    3.1.409
    3.1.408
    3.1.407
    3.1.406
    3.1.405
    3.1.404
    3.1.403
    3.1.402
    3.1.401
    3.1.301
    3.1.300
    3.1.200
    3.1.102
    3.1.101
    3.1.100
    3.0.101
    3.0.100
    2.1.701
    2.1.700
    2.1.505
    2.1.504
    2.1.503
    2.1.302
    2.1.301
    2.1.4
    2.0.0
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    6.0.8
    6.0.7
    6.0.5
    6.0.1
    5.0.17
    5.0.13
    5.0.12
    5.0.11
    5.0.9
    5.0.8
    5.0.6
    5.0.5
    5.0.4
    5.0.3
    5.0.2
    5.0.0
    3.1.28
    3.1.27
    3.1.25
    3.1.22
    3.1.21
    3.1.20
    3.1.18
    3.1.17
    3.1.15
    3.1.14
    3.1.13
    3.1.12
    3.1.11
    3.1.10
    3.1.9
    3.1.8
    3.1.7
    3.1.5
    3.1.4
    3.1.2
    3.1.1
    3.1.0
    3.0.1
    3.0.0
    2.1.23
    2.1.22
    2.1.21
    2.1.19
    2.1.18
    2.1.17
    2.1.16
    2.1.15
    2.1.14
    2.1.13
    2.1.12
    2.1.11
    2.1.9
    2.1.8
    2.1.7
    2.1.2
    2.1.1
    2.0.5
    2.0.0

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Version: 13.0.0.0 (Visual Studio Community)
Commit: xamarin-android/d17-3/030cd63
Android SDK: /Users/andoni/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        8.0  (API level 26)
        6.0  (API level 23)
        12.0 (API level 31)
        4.4  (API level 19)
        8.1  (API level 27)
        5.0  (API level 21)
        11.0 (API level 30)
        10.0 (API level 29)
        7.1  (API level 25)
        9.0  (API level 28)
        7.0  (API level 24)

SDK Command-line Tools Version: 5.0
SDK Platform Tools Version: 31.0.3
SDK Build Tools Version: 30.0.3

Build Information: 
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.3.0.23
Hash: 965bf40
Branch: remotes/origin/d17-3
Build date: 2022-08-11 21:30:03 UTC

Android Device Manager
Version: 0.0.0.1169
Hash: fafb1d5
Branch: fafb1d5
Build date: 2022-08-11 21:30:03 UTC

Xamarin Designer
Version: 17.3.0.208
Hash: 0de472ea0
Branch: remotes/origin/d17-3
Build date: 2022-08-11 21:29:58 UTC

Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400

Build Information
Release ID: 1703010411
Git revision: 22408f3ad66bf33ab9530b882011bed98ebf1503
Build date: 2022-08-11 21:28:07+00
Build branch: release-17.3
Build lane: release-17.3

Operating System
Mac OS X 12.3.1
Darwin 21.4.0 Darwin Kernel Version 21.4.0
    Fri Mar 18 00:45:05 PDT 2022
    root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
miadey commented 1 year ago

Workaround that I used and worked for me. Seem that Dotnet get mixed-up when multiple framework are installed.

in bash: Locate Dotnet folder with Find, the one withthe sdk and runtume folder. rm -rf Dotnet. Reinstall sdk and runtime You’ll get a fresh 6 and 7 installation Worked for me

MaximG1234 commented 1 year ago

Not overly helpful but can confirm I ran into this issue myself yesterday. I had to revert back to Preview 7 which after some fiddling around resolved the issue.

Mephisztoe commented 1 year ago

I too ran into this problem after upgrading Visual Studio to 17.4.0 Preview 2.1.

However, I then tried restoring the workloads as suggested above with this command:

dotnet workload restore --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json

The command sucessfully installed everything: Welcome to .NET 7.0!

SDK Version: 7.0.100-rc.1.22431.12


Installed an ASP.NET Core HTTPS development certificate. To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). Learn about HTTPS: https://aka.ms/dotnet-https

Write your first app: https://aka.ms/dotnet-hello-world Find out what's new: https://aka.ms/dotnet-whats-new Explore documentation: https://aka.ms/dotnet-docs Report issues and find source on GitHub: https://github.com/dotnet/core Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli

Installing workloads:

The machine has a pending reboot. Installation will continue, but you may need to restart. Downloading microsoft.net.sdk.android.manifest-7.0.100-rc.1.msi.x64 (33.0.0-rc.1.152) Installing Microsoft.NET.Sdk.Android.Manifest-7.0.100-rc.1.33.0.0-rc.1.152-x64.msi ..... Done Downloading microsoft.net.sdk.ios.manifest-7.0.100-rc.1.msi.x64 (15.4.1031-rc.1) Installing Microsoft.NET.Sdk.iOS.Manifest-7.0.100-rc.1.15.4.1031-rc.1-x64.msi .... Done Downloading microsoft.net.sdk.maccatalyst.manifest-7.0.100-rc.1.msi.x64 (15.4.1031-rc.1) Installing Microsoft.NET.Sdk.MacCatalyst.Manifest-7.0.100-rc.1.15.4.1031-rc.1-x64.msi ..... Done Downloading microsoft.net.sdk.macos.manifest-7.0.100-rc.1.msi.x64 (12.3.1031-rc.1) Installing Microsoft.NET.Sdk.macOS.Manifest-7.0.100-rc.1.12.3.1031-rc.1-x64.msi ..... Done Downloading microsoft.net.sdk.maui.manifest-7.0.100-rc.1.msi.x64 (7.0.0-rc.2.6736) Installing Microsoft.NET.Sdk.Maui.Manifest-7.0.100-rc.1.7.0.0-rc.2.6736-x64.msi ..... Done Downloading microsoft.net.sdk.tvos.manifest-7.0.100-rc.1.msi.x64 (15.4.1031-rc.1) Installing Microsoft.NET.Sdk.tvOS.Manifest-7.0.100-rc.1.15.4.1031-rc.1-x64.msi ..... Done Downloading microsoft.net.workload.mono.toolchain.net6.manifest-7.0.100.msi.x64 (7.0.0-rtm.22472.8) Installing Microsoft.NET.Workload.Mono.ToolChain.net6.Manifest-7.0.100.7.0.0-rtm.22472.8-x64.msi ..... Done Downloading microsoft.net.workload.mono.toolchain.net7.manifest-7.0.100.msi.x64 (7.0.0-rtm.22472.8) Installing Microsoft.NET.Workload.Mono.ToolChain.net7.Manifest-7.0.100.7.0.0-rtm.22472.8-x64.msi ..... Done Downloading microsoft.net.workload.emscripten.net6.manifest-7.0.100.msi.x64 (7.0.0-rtm.22468.1) Installing Microsoft.NET.Workload.Emscripten.net6.Manifest-7.0.100.7.0.0-rtm.22468.1-x64.msi ..... Done Downloading microsoft.net.workload.emscripten.net7.manifest-7.0.100.msi.x64 (7.0.0-rtm.22468.1) Installing Microsoft.NET.Workload.Emscripten.net7.Manifest-7.0.100.7.0.0-rtm.22468.1-x64.msi .... Done

Successfully installed workload(s) .

I then did a Clean project, deleted bin and obj folder and am finally rebooting my machine n...

Mephisztoe commented 1 year ago

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... :(

davidbuckleyni commented 1 year ago

Same issue with me getting kind of tired with MS working on staff only builds and releasing stuff that is not customer ready ! My issue is on windows 11

image

Redth commented 1 year ago

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!

Mephisztoe commented 1 year ago

Tried that, didn't work. There's some signature missing:

image

Added --skip-sign-check as suggested by @jamesmontemagno

Failed anyway: image

Lemonfruut commented 1 year ago

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!

This worked for me! I was originally getting the following error:

platform version is not present for one or more target frameworks, even though they have specified a platform: net7.0-maccatalyst

but now I can build without errors!

Redth commented 1 year ago

Tried that, didn't work. There's some signature missing:

image

Added --skip-sign-check as suggested by @jamesmontemagno

Failed anyway: image

That version it's looking for was never published to nuget, so presumably at some point you did an install/update with additional package sources in the context of that update that aren't included now.

I'd rather not confuse this thread with this side issue, please follow up with James, I have some ideas.

ss-proc commented 1 year ago

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

@Redth Thanks! This worked for me. I was able to successfully build on .NET 7 rc1 + MAUI rc1 + Xcode 14 + Jetbrains Rider. I'm running into a problem with running the app. But that issue is tracked on https://github.com/xamarin/xamarin-macios/issues/15954

Conbag93 commented 1 year ago

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.

davidbuckleyni commented 1 year ago

image

That seemed to have better sucess will try running the app now

davidbuckleyni commented 1 year ago

Still getting futher issues here

image

Redth commented 1 year ago

We've published the packages after validating they install and correct the specific issue where you installed a standalone .NET 7 RC1 SDK before installing VS 17.4 P2.1.

Until we're able to ship an update with the next VS 17.4 preview, you can work around it with the following:

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

Thanks for your patience!

Conbag93 commented 1 year ago

We've published the packages after validating they install and correct the specific issue where you installed a standalone .NET 7 RC1 SDK before installing VS 17.4 P2.1.

Until we're able to ship an update with the next VS 17.4 preview, you can work around it with the following:

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

Thanks for your patience!

Hello - with reference to my earlier comment - based on my experience - I do not think command alone is enough.

If you have .NET 7 RC1 pre-installed, then running dotnet workload list throws a Dictionary exception. The same exception is thrown when running this command, and the workloads are not installed.

I had to manually remove the offending workloads before dotnet workload install maui android ios maccatalyst macos would run without issues.

florianwachs commented 1 year ago

worked for me, thanks a lot for your work!

codemonkey85 commented 1 year ago

Unfortunately that isn't working for me: Workload installation failed: One or more errors occurred. (Response status code does not indicate success: 401 (Unauthorized).)

WindowsTerminal_jRZnUyD9zl

matt-goldman commented 1 year ago

Since installing the latest Visual Studio preview I've been getting this error:

image

I've tried installing the tizen workload, removing tizen as a TFM from my project, and I've tried running dotnet workload restore as per the suggestion with the error. I've also tried all the suggestions here to no avail. I went the brute force approach and uninstalled every version of Visual Studio, every dotnet workload, and then installed a fresh instance of Visual Studio 2022 Enterprise. And I still get this error.

I think I've hit reinstall Windows territory. Is there anything else I can try first?

Edit to add: I'm assuming this is the same issue as mentioned here but if not let me know and I will open a new one.

davidbuckleyni commented 1 year ago

Thid is still not solved

tsjdev-apps commented 1 year ago

I'm still struggeling. I've already tried to uninstall Visual Studio and also Visual Studio Preview from my Windows machine. After installing only Visual Studio again, I encountered the same issue. The only workaround for me is to remove the net6.0-ios and net6.0-maccatalyst from the csproj file. So is there any other workaroung for .NET 6.0 MAUI apps?

davefxy commented 1 year ago

I believe you can use the global.json file. Put it in the project directory (same place as csproj). This will indicate to VS that the project should use Net 6. In this file put the following: '{ "sdk": { "version": "6.0.400", "rollForward": "latestMinor" } }'