dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.75k stars 1.07k forks source link

Unable to build the .NET MAUI Preview 9 project, VS IDE reports missing components, maui-check tool unable to find the package as it still points to RC 1 source feed #22009

Open egvijayanand opened 3 years ago

egvijayanand commented 3 years ago

Description

Unable to build the .NET MAUI Preview 9 project, VS IDE reports missing components, maui-check tool unable to find the package as it still points to RC 1 source

Steps to Reproduce

  1. Update VS2022 to Preview 5 (17.0.0 Preview 5.0) with .NET MAUI (Preview) optional workload installed
  2. Updated the .NET MAUI templates to the latest (preview 9) dotnet new --install Microsoft.Maui.Templates
  3. Tried creating a new .NET MAUI project from both CLI and VS IDE, upon loading the project in VS IDE, it reports missing components, but upon launching VS installer, it reports all the required components are up-to-date. Refer attached screenshots
  4. Tried to update the workloads/missing components to the latest using both dotnet workload update and maui-check and they end up in error as they still point to the RC1 feeds
  5. Error reported by dotnet workload update command - microsoft.net.sdk.maui.manifest-6.0.100.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds
  6. Error reported by maui-check command - microsoft.maui.core.ref.android.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds

Kindly let me know the RC2 source feed URL to try the same and I tried the below URL but it's not available (https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rc.2.21505.57-shipping/nuget/v3/index.json).

Expected Behavior

The project should build and run on all the supported platforms.

Actual Behavior

Reports missing components and there is no solution to install/update them for now.

Basic Information

Screenshots

dotnetmaui-preview9-component-issue-1 dotnetmaui-preview9-component-issue-2 dotnetmaui-preview9-component-issue-3 dotnetmaui-preview9-component-issue-4

Reproduction Link

Workaround

juanlao commented 3 years ago

After run "dotnet build -t:Run -f net6.0-android" in the csproj folder, we were able to deploy again and see all emulators :)

egvijayanand commented 3 years ago

It didn't resolve, the issue still persists. BTW, What's the source feed for RC2 packages?

Here is the output of the build command and the suggested solution from the same (workload install command):

E:\Maui\Preview 9\MauiApp2\MauiApp2>dotnet build -f:net6.0-android Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore... C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-android [E:\Maui\Preview 9\MauiApp2\MauiApp2\MauiApp2.csproj] C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload install maui-android [E:\Maui\Preview 9\MauiApp2\MauiApp2\MauiApp2.csproj]

E:\Maui\Preview 9\MauiApp2\MauiApp2>dotnet workload install maui-android

Updated advertising manifest microsoft.net.sdk.android. Updated advertising manifest microsoft.net.sdk.maui. Updated advertising manifest microsoft.net.sdk.macos. Updated advertising manifest microsoft.net.sdk.ios. Updated advertising manifest microsoft.net.workload.emscripten. Updated advertising manifest microsoft.net.workload.mono.toolchain. Updated advertising manifest microsoft.net.sdk.tvos. Updated advertising manifest microsoft.net.sdk.maccatalyst. Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.101-preview.9.1805) Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.101-preview.9.1805) Workload installation failed. Rolling back installed packs... Downloading microsoft.net.sdk.maui.manifest-6.0.100.msi.x64 (6.0.101-preview.9.1805) Installation rollback failed: One or more errors occurred. (microsoft.net.sdk.maui.manifest-6.0.100.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\;E:\Tasks\Projects\Templates\Release\NuGet".) Workload installation failed: One or more errors occurred. (microsoft.maui.core.ref.android.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\;E:\Tasks\Projects\Templates\Release\NuGet".)

Regards, Vijay Anand E G

migueBarrera commented 3 years ago

It didn't resolve, the issue still persists. BTW, What's the source feed for RC2 packages?

Here is the output of the build command and the suggested solution from the same (workload install command):

E:\Maui\Preview 9\MauiApp2\MauiApp2>dotnet build -f:net6.0-android Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore... C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-android [E:\Maui\Preview 9\MauiApp2\MauiApp2\MauiApp2.csproj] C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload install maui-android [E:\Maui\Preview 9\MauiApp2\MauiApp2\MauiApp2.csproj]

E:\Maui\Preview 9\MauiApp2\MauiApp2>dotnet workload install maui-android

Updated advertising manifest microsoft.net.sdk.android. Updated advertising manifest microsoft.net.sdk.maui. Updated advertising manifest microsoft.net.sdk.macos. Updated advertising manifest microsoft.net.sdk.ios. Updated advertising manifest microsoft.net.workload.emscripten. Updated advertising manifest microsoft.net.workload.mono.toolchain. Updated advertising manifest microsoft.net.sdk.tvos. Updated advertising manifest microsoft.net.sdk.maccatalyst. Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.101-preview.9.1805) Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.101-preview.9.1805) Workload installation failed. Rolling back installed packs... Downloading microsoft.net.sdk.maui.manifest-6.0.100.msi.x64 (6.0.101-preview.9.1805) Installation rollback failed: One or more errors occurred. (microsoft.net.sdk.maui.manifest-6.0.100.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages;E:\Tasks\Projects\Templates\Release\NuGet".) Workload installation failed: One or more errors occurred. (microsoft.maui.core.ref.android.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages;E:\Tasks\Projects\Templates\Release\NuGet".)

Regards, Vijay Anand E G

The solution of @juanlao has worked for me. have you tried restarting VS2022 after executing the command @juanlao says? Have you run the maui-check?

egvijayanand commented 3 years ago

It didn't resolve, the issue still persists. BTW, What's the source feed for RC2 packages? Here is the output of the build command and the suggested solution from the same (workload install command): E:\Maui\Preview 9\MauiApp2\MauiApp2>dotnet build -f:net6.0-android Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-android [E:\Maui\Preview 9\MauiApp2\MauiApp2\MauiApp2.csproj] C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload install maui-android [E:\Maui\Preview 9\MauiApp2\MauiApp2\MauiApp2.csproj] E:\Maui\Preview 9\MauiApp2\MauiApp2>dotnet workload install maui-android Updated advertising manifest microsoft.net.sdk.android. Updated advertising manifest microsoft.net.sdk.maui. Updated advertising manifest microsoft.net.sdk.macos. Updated advertising manifest microsoft.net.sdk.ios. Updated advertising manifest microsoft.net.workload.emscripten. Updated advertising manifest microsoft.net.workload.mono.toolchain. Updated advertising manifest microsoft.net.sdk.tvos. Updated advertising manifest microsoft.net.sdk.maccatalyst. Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.101-preview.9.1805) Downloading Microsoft.Maui.Core.Ref.android.Msi.x64 (6.0.101-preview.9.1805) Workload installation failed. Rolling back installed packs... Downloading microsoft.net.sdk.maui.manifest-6.0.100.msi.x64 (6.0.101-preview.9.1805) Installation rollback failed: One or more errors occurred. (microsoft.net.sdk.maui.manifest-6.0.100.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages;E:\Tasks\Projects\Templates\Release\NuGet".) Workload installation failed: One or more errors occurred. (microsoft.maui.core.ref.android.msi.x64::6.0.101-preview.9.1805 is not found in NuGet feeds https://api.nuget.org/v3/index.json;C:\Program Files (x86)\Microsoft SDKs\NuGetPackages;E:\Tasks\Projects\Templates\Release\NuGet".) Regards, Vijay Anand E G

The solution of @juanlao has worked for me. have you tried restarting VS2022 after executing the command @juanlao says? Have you run the maui-check?

Yes, tried all those possibilities. Workload update, maui-check, VS restart, Machine restart.

From the command of fix applied by maui-check, it is evident that the package source feed still points to RC 1.

dotnet workload update --no-cache --disable-parallel --from-rollback-file "C:\Users\devuser\AppData\Local\Temp\maui-check-36fcb5c0\workload.json" --source "https://api.nuget.org/v3/index.json" --source "https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rc.1.21458.32-shipping/nuget/v3/index.json"

Could not able to figure out the source feed URL for RC 2/Preview 9, can someone from the MAUI engineering team share the feed URL to resolve this issue?

LuohuaRain commented 3 years ago

yep, same problem. A lot warnings NU1603 and publish failed

egvijayanand commented 3 years ago

Found a temporary workaround by installing Microsoft.NET.Sdk.Maui.Manifest from this URL

https://download.visualstudio.microsoft.com/download/pr/183b6111-ff83-4e7c-bb14-5dc5ec2aef03/151f076c530b97cc52b98903685eadb11d598150467c7e43db2e536f1850c781/Microsoft.NET.Sdk.Maui.Manifest-6.0.100.6.0.101-preview.9.1843-x64.msi

Download the installer package, launch it and run it in Repair mode even if it is already installed.

As highlighted by @LuohuaRain, there is a lot of NU1603 warnings but am able to deploy the app to an Android physical device.

But still the Windows platform is having issues, trying to resolve it.

mattleibow commented 3 years ago

Can you check your PATH environment variable and make sure the C:\Program Files\dotnet comes BEFORE the C:\Program Files (x86)\dotnet?

I noticed this happening a few days ago on some of my machines.

egvijayanand commented 3 years ago

Post-installation of the Manifest MSI, executing dotnet workload update / maui-check installed all the required components, thus resolving the issue and am able to run the App on Android and Windows.

Request to investigate the issue on why it has not detected the change even though the Manifest already installed as part of VS IDE update.

dotnetmaui-preview9-component-issue-5 dotnetmaui-preview9-component-issue-6
egvijayanand commented 3 years ago

Can you check your PATH environment variable and make sure the C:\Program Files\dotnet comes BEFORE the C:\Program Files (x86)\dotnet?

I noticed this happening a few days ago on some of my machines.

While installing the .NET 6 RC 2 SDK, faced the issue as depicted in the screenshot. But on machine restart, it disappeared and continued with the SDK update.

dotnet6-rc2-sdk-win64-issue
egvijayanand commented 3 years ago

This is the order in which environment variables are found:

C:\Program Files\dotnet\ C:\Program Files (x86)\dotnet\

mattleibow commented 3 years ago

Are you able to run windows apps mow?

egvijayanand commented 3 years ago

Are you able to run windows apps mow?

Yes. After manifest repair, installed the maui workload. With which, am able to run the app.

mindtalk69 commented 3 years ago

I got mine problem as well, but did resolve which follow like the other preview.

The recommended fix is to manually delete everything under "C:\Program Files\dotnet\metadata\workloads" and then install the workloads manually followed by another run at maui-check. And yup maui-check still help for me.

hope it helps.

LuohuaRain commented 3 years ago

I got mine problem as well, but did resolve which follow like the other preview.

The recommended fix is to manually delete everything under "C:\Program Files\dotnet\metadata\workloads" and then install the workloads manually followed by another run at maui-check. And yup maui-check still help for me.

hope it helps.

it works for me. thanks.

ericstj commented 3 years ago

For those facing this as a result of PATH being out of order see https://github.com/dotnet/sdk/issues/22047.

sfoslund commented 3 years ago

@mattleibow are there any outstanding issues we should take a look at here? It looks like everything got sorted out.

beto-rodriguez commented 3 years ago

In my case, in addition to

https://github.com/dotnet/sdk/issues/22009#issuecomment-942430121

and

https://github.com/dotnet/sdk/issues/22009#issuecomment-942480651

I also had to update the Maui templates manually:

dotnet new --install Microsoft.Maui.Templates::6.0.101-preview.9.1843

It works on Android, it compiles on windows but it is not able to deploy even I If I right click -> Deploy. I noticed I do not have the C:\Program Files (x86)\dotnet\ variable

2>------ Deploy started: Project: MauiApp4, Configuration: Debug Any CPU ------ 2>Need recipe file ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

Joren-Thijs commented 3 years ago

I recently had to go into my C:\Program Files\dotnet folder and manually delete a bunch of old dotnet maui templates and preview 6 stuff that was left behind.

After that i ran the cleanup script from the maui-check repo again.

After that maui-check was able to correctly install all the additional workloads for me.

Hope this helps!

bravecobra commented 3 years ago

After upgrading to preview 10, I got it to work properly.

dotnet workload install maui `
   --from-rollback-file https://aka.ms/dotnet/maui/preview.10.json `
   --source https://aka.ms/dotnet6/nuget/index.json `
   --source https://api.nuget.org/v3/index.json

The VS installer however still references preview9, which seems to be broken due to missing Nuget packages on the feed.

dhabierre commented 3 years ago

Many errors here too after VS update (=> 17.1.0 Preview 1.1)

First quit all VS instances

Then I deleted the content of C:\Program Files\dotnet\metadata\workloads\ (thanks to @mindtalk69)

Finally Powershell with admin rights

dotnet workload update
dotnet workload list
dotnet workload install maui
dotnet workload install maui-android
dotnet workload install maui-ios
maui-check

And all these issues disappeared. Hop it helps.

mattleibow commented 3 years ago

The maui-check tool should no longer be needed as we just use the workloads. In fact, if you are installing VS for the first time, you probably should not use the CLI and let the IDE install and update workloads. This makes things run more smoothly.