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

Cannot run the samples on Linux because of workload dependencies #91

Open
timothyparez opened this issue Nov 13, 2024 · 6 comments
Open

Comments

@timothyparez
Copy link

If you clone this repository and try to run it on Linux it will fail
because the android and macos workloads are not available:

/usr/lib/dotnet/sdk/8.0.110/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: The target platform identifier android was not recognized. [...../Projects/Avalonia.Labs/src/Avalonia.Labs.Notifications/Avalonia.Labs.Notifications.csproj::TargetFramework=net8.0-android]
/usr/lib/dotnet/sdk/8.0.110/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(117,5): error NETSDK1139: The target platform identifier macos was not recognized. [.../Projects/Avalonia.Labs/samples/Avalonia.Labs.Catalog.Desktop/Avalonia.Labs.Catalog.Desktop.csproj::TargetFramework=net8.0-macos]

@emmauss
Copy link
Collaborator

emmauss commented Nov 13, 2024

Install the dotnet android and macos workloads

@timothyparez
Copy link
Author

That doesn't work on Linux/Ubuntu

dotnet workload install android
Workload ID android is not recognized
dotnet workload install maui-android
Workload ID maui-android is not recognized

Other workloads like wasm-tools etc are supported.
It doesn't seem like Microsoft ever had the intention of making Xamarin/Maui stuff work on Linux.
(Which is one of the reasons we use Avalonia instead of MAUI)

@emmauss
Copy link
Collaborator

emmauss commented Nov 13, 2024

Did you install dotnet using the official install scripts from the dotnet site, or using "apt". Using the install scripts is recommended.

@timothyparez
Copy link
Author

I probably installed via apt.
I will try the install scripts on a different machine.

@maxkatz6
Copy link
Member

All standard workloads, except iOS, should be buildable on Linux.

@Genteure
Copy link

$ dotnet build samples/Avalonia.Labs.Catalog.Desktop/Avalonia.Labs.Catalog.Desktop.csproj
  Determining projects to restore...
/path/to/dotnet/sdk/8.0.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1178: The project depends on the following workload packs that do not exist in any of the workloads available in this installation: Microsoft.iOS.Sdk.net8.0_18.0 [/path/to/Avalonia.Labs/src/Avalonia.Labs.Notifications/Avalonia.Labs.Notifications.csproj::TargetFramework=net8.0-ios]
/path/to/dotnet/sdk/8.0.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1178: You may need to build the project on another operating system or architecture, or update the .NET SDK. [/path/to/Avalonia.Labs/src/Avalonia.Labs.Notifications/Avalonia.Labs.Notifications.csproj::TargetFramework=net8.0-ios]

Build FAILED.

/path/to/dotnet/sdk/8.0.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1178: The project depends on the following workload packs that do not exist in any of the workloads available in this installation: Microsoft.iOS.Sdk.net8.0_18.0 [/path/to/Avalonia.Labs/src/Avalonia.Labs.Notifications/Avalonia.Labs.Notifications.csproj::TargetFramework=net8.0-ios]
/path/to/dotnet/sdk/8.0.404/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1178: You may need to build the project on another operating system or architecture, or update the .NET SDK. [/path/to/Avalonia.Labs/src/Avalonia.Labs.Notifications/Avalonia.Labs.Notifications.csproj::TargetFramework=net8.0-ios]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.61
`dotnet --info` log dump
$ dotnet workload install android wasm-tools macos ios
Workload installation failed: Workload ID ios isn't supported on this platform.
$ dotnet workload install android wasm-tools macos 

Workload(s) 'wasm-tools android macos' are already installed.
...
Successfully installed workload(s) .

$ dotnet --info
.NET SDK:
 Version:           8.0.404
 Commit:            7b190310f2
 Workload version:  8.0.400-manifests.22517898
 MSBuild version:   17.11.9+a69bbaaf5

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  24.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /path/to/dotnet/sdk/8.0.404/

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
 [wasm-tools]
   Installation Source: SDK 8.0.400
   Manifest Version:    8.0.11/8.0.100
   Manifest Path:       /path/to/dotnet/sdk-manifests/8.0.100/microsoft.net.workload.mono.toolchain.current/8.0.11/WorkloadManifest.json
   Install Type:        FileBased

 [android]
   Installation Source: SDK 8.0.400
   Manifest Version:    34.0.145/8.0.100
   Manifest Path:       /path/to/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.android/34.0.145/WorkloadManifest.json
   Install Type:        FileBased

 [wasi-experimental]
   Installation Source: SDK 8.0.400
   Manifest Version:    8.0.11/8.0.100
   Manifest Path:       /path/to/dotnet/sdk-manifests/8.0.100/microsoft.net.workload.mono.toolchain.current/8.0.11/WorkloadManifest.json
   Install Type:        FileBased

 [macos]
   Installation Source: SDK 8.0.400
   Manifest Version:    15.0.8316/8.0.100
   Manifest Path:       /path/to/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.macos/15.0.8316/WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.11
  Architecture: x64
  Commit:       9cb3b725e3

.NET SDKs installed:
  6.0.428 [/path/to/dotnet/sdk]
  8.0.404 [/path/to/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.36 [/path/to/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.11 [/path/to/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.36 [/path/to/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.11 [/path/to/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/path/to/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Workaround:

In Avalonia.Labs.Catalog.Desktop.csproj:

     <OutputType>Exe</OutputType>
+    <TargetFrameworks>net8.0</TargetFrameworks>
-    <TargetFrameworks>net8.0;net8.0-macos</TargetFrameworks>
     <Nullable>enable</Nullable>

In Avalonia.Labs.Notifications.csproj:

     <LangVersion>latest</LangVersion>
+    <TargetFrameworks>net8.0;net8.0-android</TargetFrameworks>
-    <TargetFrameworks>net8.0;net8.0-android;net8.0-ios</TargetFrameworks>
     <SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net8.0-ios'">13.0</SupportedOSPlatformVersion>

And run

dotnet run --framework net8.0 --project samples/Avalonia.Labs.Catalog.Desktop/Avalonia.Labs.Catalog.Desktop.csproj

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

No branches or pull requests

4 participants