Skip to content

Better error message attempting to target net6.0-android from .NET 8 #8003

Description

@jpobst

In #7900 we removed the ability to target net6.0-android from a .NET 8 install.

However if a user attempts this, they receive an incorrect error message:

.../Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools-net6 
.../Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore 

If they attempt to run dotnet workload restore as instructed, they receive:

.../8.0.100-preview.3/microsoft.net.sdk.android/WorkloadManifest.targets(7,5): error : Could not resolve SDK "Microsoft.Android.Sdk.net6". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
.../8.0.100-preview.3/microsoft.net.sdk.android/WorkloadManifest.targets(7,5): error :   SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
.../8.0.100-preview.3/microsoft.net.sdk.android/WorkloadManifest.targets(7,5): error :   The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
.../8.0.100-preview.3/microsoft.net.sdk.android/WorkloadManifest.targets(7,5): error :   MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Android.Sdk.net6" because directory "/Users/runner/hostedtoolcache/dotnet/sdk/8.0.100-preview.3.23178.7/Sdks/Microsoft.Android.Sdk.net6/Sdk" did not exist.

We need to provide a better error message to the user letting them know this scenario isn't possible rather than provide instructions that will not work.

This issue should be reproducible with the following TF:

<TargetFrameworks>net6.0-android;net8.0-android</TargetFrameworks>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions