Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default xplat project cannot be built when .net8.0 is installed on linux (NETSDK1139: target platform 'android' is not recognized). #14897

Closed
Ninjastorm380 opened this issue Mar 9, 2024 · 11 comments
Labels

Comments

@Ninjastorm380
Copy link

Ninjastorm380 commented Mar 9, 2024

Describe the bug

Newly created cross-platform projects fail to build when net8.0 is installed. uninstalling anything related to .net8.0 and manually editing each project to instead point to net7.0 resolves this.

full error from dotnet build:

/usr/share/dotnet/sdk/8.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: The target platform identifier android was not recognized. [/home/prydaran/Documents/Rider/TestAvaloniaNet8/TestAvaloniaNet8.Android/TestAvaloniaNet8.Android.csproj]

To Reproduce

  • follow instructions for setting up a development environment on linux over at the avalonia documentation
  • create a new cross-platform avalonia project (dotnet new avalonia.xplat)
  • restore any potentially missing workloads (sudo dotnet workload restore)
  • install appropriate android workload related items (JDK, SDK)
  • attempt to build.

Expected behavior

Project builds successfully.

Avalonia version

11.0.10

OS

Linux, Android

Additional context

it should be noted that this issue occurrs with both the CLI (dotnet), and with Rider (both normal and EAP). When creating a project in rider, the only option to choose for .net sdk is .net8.0 for an avalonia cross-platform project, even if .net8.0 is not installed.
Rider's project window:
image

@maxkatz6
Copy link
Member

maxkatz6 commented Mar 9, 2024

dotnet workload install android

@maxkatz6 maxkatz6 closed this as completed Mar 9, 2024
@Ninjastorm380
Copy link
Author

Ninjastorm380 commented Mar 10, 2024

@maxkatz6 no effect (I tried this already, please reopen)

@Ninjastorm380
Copy link
Author

Ninjastorm380 commented Mar 10, 2024

also, workload android doesn't exist for net8.0 according to dotnet workload search

@Ninjastorm380
Copy link
Author

@maxkatz6 @AArnott somebody?

@timunie
Copy link
Contributor

timunie commented Mar 10, 2024

Workload exits for net8, I've installed it on my own. Try it from command line, as VS seems to be buggy here acc to some SO questions.

Note: If you need urgent support, you need payed support. Or wait until community has time to.

@Ninjastorm380
Copy link
Author

Ninjastorm380 commented Mar 10, 2024

@timunie Apologies, I had assumed that since they had closed it that they had just left me to fend for myself. here's the output of dotnet workload search, with .net8.0 installed:

[prydaran@prydaran-framework-13 ~]$ dotnet workload search

Workload ID                 Description                                     
----------------------------------------------------------------------------
aspire                      .NET Aspire SDK (Preview)                       
wasi-experimental           workloads/wasi-experimental/description         
wasm-experimental           workloads/wasm-experimental/description         
wasm-experimental-net7      .NET WebAssembly experimental tooling for net7.0
wasm-tools                  .NET WebAssembly build tools                    
wasm-tools-net6             .NET WebAssembly build tools for net6.0         
wasm-tools-net7             .NET WebAssembly build tools for net7.0

please keep in mind that this is from a linux dev environment, not windows.

@timunie
Copy link
Contributor

timunie commented Mar 10, 2024

  1. Use discussions for questions, not bug report. If .NET doesn't provide you the workload on Linux, that's nothing Avalonia can or should fix.

  2. I don't see any NET8 workload in there. Are you sure you have the correct SDK installed? Runtime is not enough.

@Ninjastorm380
Copy link
Author

output of yay dotnet:

10 extra/dotnet-targeting-pack-7.0 7.0.15.sdk115-1 (6.2 MiB 40.9 MiB) (Installed)
    The .NET Core targeting pack
9 extra/dotnet-targeting-pack-6.0 6.0.26.sdk126-1 (5.7 MiB 37.2 MiB) (Installed)
    The .NET Core targeting pack
8 extra/dotnet-targeting-pack 8.0.2.sdk102-1 (6.4 MiB 45.5 MiB) (Installed)
    The .NET Core targeting pack
7 extra/dotnet-runtime-6.0 6.0.26.sdk126-1 (22.0 MiB 64.4 MiB) (Installed)
    The .NET Core runtime
6 extra/dotnet-runtime-7.0 7.0.15.sdk115-1 (22.8 MiB 66.7 MiB) (Installed)
    The .NET Core runtime
5 extra/dotnet-runtime 8.0.2.sdk102-1 (22.6 MiB 66.3 MiB) (Installed)
    The .NET Core runtime
4 extra/dotnet-sdk-7.0 7.0.15.sdk115-1 (82.4 MiB 306.6 MiB) (Installed)
    The .NET Core SDK
3 extra/dotnet-sdk-6.0 6.0.26.sdk126-1 (72.9 MiB 280.9 MiB) (Installed)
    The .NET Core SDK
2 extra/dotnet-host 8.0.2.sdk102-1 (139.8 KiB 458.7 KiB) (Installed)
    A generic driver for the .NET Core Command Line Interface
1 extra/dotnet-sdk 8.0.2.sdk102-1 (85.3 MiB 299.3 MiB) (Installed)
    The .NET Core SDK
==> Packages to install (eg: 1 2 3, 1-3 or ^4)
==> 

Also, I Found Something. as mentioned by omajid:

Note to self: this current behaviouir results in a functional difference between a source-built SDK and a non-source-built SDK. dotnet workload list simply wouldn't show the workloads for users to install.

Edit:

As of Preview 6, the following 5 workloads are missing in a source-build SDK:

    android
    macos
    maui-android
    maui-tizen
    maui-windows

that was posted from when 8.0 was in preview 6. Later down the report, there is a linked issue involving an arch linux user not being able to find those workloads. It just so happens that's also my OS. listed workaround is that the workload manifests are missing, and should be added manually by the user...

@Ninjastorm380
Copy link
Author

Ninjastorm380 commented Mar 10, 2024

so, not a bug on your end, but that does result in unintended behaviour

@maxkatz6
Copy link
Member

also, workload android doesn't exist for net8.0 according to dotnet workload search

Please open an issue at https://github.com/dotnet/sdk/issues.
Android workloads should be available on Linux starting with .NET 8, but I guess it still might require special setup.
For the long time it wasn't available on Linux at all.

@Ninjastorm380
Copy link
Author

what's funny was that they are available for net7.0 with no issue. at this point, it's a packaging problem on microsoft's part, so I will raise a bug report there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants