-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[BUG] 'To build this project, the following workloads must be installed: maui-android', but the workload is already installed #37706
Comments
not able to reproduce it in docker with ubuntu (the reproduction repo was updated with dockerfile), so it must be nixos specific |
@baronfel can you give any advise on how to investigate it further please? |
Same problem on Ubuntu |
Interesting. Would you mind sharing how your environment is setup and if it is anywhere close to the docker file in my reproduction repo? |
ok, my bad, it actually worked but I had to:
|
@GaijinFizz thanks for linking the issue, I was not aware of it. Looks to me like the the sdk ignores |
Actually I'm wrong, by quickly searching for |
I had to create /usr/share/dotnet before copying sdk-manifests, it's worth a try :) |
I think i face the same problem. 'dotnet workload install aspire" (or any other dotnet workload install or update command) results in: although I have a file 'userlocal' present @ '/nix/store/g2mws5h1b3n08mfcxplfa98mf0rgr68p-dotnet-core-combined/metadata/workloads/8.0.300/userlocal' , which (as far as i understood) should force sdk to install workloads in my $HOME/.dotnet folder..? |
@Mr-MooMoo this is a side effect of the workloads sets feature we're working on I believe. @dsplaisted / @Forgind do we check where the install state should be written to for the user local workload scenario? If not I think we should. |
@Mr-MooMoo do you have $DOTNET_ROOT env variable set? In my case installation completes successfully and files are present in ~/.dotnet, but sdk fails to run restore/build/etc |
@anpin yes; it points to the (correct) nix-store path:
|
FYI @marcpopMSFT @baronfel Looks like the workload install state doesn't work with the user local workload setting. |
Triage: For the original issue, the binlog lists that it's trying to find rc2 workloads but the --info output lists the 8.0.3 version installed. The build does full resolution. The list command just looks at the install records. @anpin the --info output looks like we're finding manifests from a couple of different locations where the manifests are found but I would bet you have rc2 manifests under the dotnet location where the sdk is found. Can you check that? CC @tmds as there may be something off here with how user local installs are working currently. We may need to take a look at --info and list and ensure they are correctly pulling data for user local installs. There is also the issue the other user hit around access to install state for user local installs. |
The user local installs are used for an SDK band when there is a file at I assume the bad situation could come from doing a "sudo" workload install for an SDK that has the Are there some steps here to reproduce the issue? Preferably in a container. User local installs work fine for me with the Fedora source-built SDK:
|
maui workloads can't be installed on source-built SDKs: #38171 (comment). Until this get resolved, the suggested workaround is to install a Microsoft SDK: #38171 (comment). |
I do not understand, I installed .net8.0 with the MS script but the maui workload restore did not work out of the box, I had to duplicate the sdk-manifests folder. |
@marcpopMSFT here is updated info. I removed ~/.dotnet and used more recent sdk. (All the files below are included in the reproduction repo from original post) dotnet workload restore -v diag --project ./maui-on-nix.sln > restore_log.txt 2>&1 > dotnet --info
.NET SDK:
Version: 8.0.204
Commit: c338c7548c
Workload version: 8.0.200-manifests.9f663350
Runtime Environment:
OS Name: nixos
OS Version: 24.11
OS Platform: Linux
RID: linux-x64
Base Path: /nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/
.NET workloads installed:
[maui-android]
Installation Source: SDK 8.0.200
Manifest Version: 8.0.3/8.0.100
Manifest Path: /nix/store/zxq761i5cj7d9ainch7d3g35w2b9c4sj-dotnet-core-combined/sdk-manifests/8.0.100/microsoft.net.sdk.maui/8.0.3/WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.4
Architecture: x64
Commit: 2d7eea2529
.NET SDKs installed:
8.0.204 [/nix/store/zxq761i5cj7d9ainch7d3g35w2b9c4sj-dotnet-core-combined/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.4 [/nix/store/zxq761i5cj7d9ainch7d3g35w2b9c4sj-dotnet-core-combined/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.4 [/nix/store/zxq761i5cj7d9ainch7d3g35w2b9c4sj-dotnet-core-combined/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/nix/store/zxq761i5cj7d9ainch7d3g35w2b9c4sj-dotnet-core-combined]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download > tree -paug ~/.dotnet > contents_of_.dotnet.txt > tree -paug $DOTNET_ROOT > contents_of_dotnet_root.txt > dotnet restore -bl
Determining projects to restore...
/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/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 [/home/a/projects/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/a/projects/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android] |
@tmds here is a docker file to run reproduction repo. AFAIK nixos uses binary sdk by default with an option to use source built sdk NixOS/nixpkgs#190129 FROM nixos/nix:latest
RUN git clone https://github.com/anpin/maui-on-nix
WORKDIR /maui-on-nix
RUN nix --extra-experimental-features "nix-command flakes" develop --command bash -c "\
dotnet workload restore -v detailed && \
dotnet restore -v detailed && \
dotnet build -v detailed" ...
.0.204/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets" from project "/maui-on-nix/src/MauiOnNix.csproj" (target "_CheckForUnsupportedTargetPlatformIdentifier" depends on it):
Using "ShowMissingWorkloads" task from assembly "/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/../tools/net8.0/Microsoft.NET.Build.Tasks.dll".
Task "ShowMissingWorkloads"
2:9>/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/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 [/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
Done executing task "ShowMissingWorkloads" -- FAILED.
2:9>Done building target "_CheckForMissingWorkload" in project "MauiOnNix.csproj" -- FAILED.
2:9>Done Building Project "/maui-on-nix/src/MauiOnNix.csproj" (_GenerateProjectRestoreGraphPerFramework target(s)) -- FAILED.
2:7>Done executing task "MSBuild" -- FAILED.
2:7>Done building target "_GenerateProjectRestoreGraphAllFrameworks" in project "MauiOnNix.csproj" -- FAILED.
2:7>Done Building Project "/maui-on-nix/src/MauiOnNix.csproj" (_GenerateProjectRestoreGraph target(s)) -- FAILED.
1>Done executing task "MSBuild" -- FAILED.
1>Done building target "_GenerateRestoreGraph" in project "maui-on-nix.sln" -- FAILED.
1>Done Building Project "/maui-on-nix/maui-on-nix.sln" (Restore target(s)) -- FAILED.
Build FAILED.
"/maui-on-nix/maui-on-nix.sln" (Restore target) (1) ->
"/maui-on-nix/src/MauiOnNix.csproj" (_GenerateProjectRestoreGraph target) (2:7) ->
"/maui-on-nix/src/MauiOnNix.csproj" (_GenerateProjectRestoreGraphPerFramework target) (2:9) ->
(_CheckForMissingWorkload target) ->
/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/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 [/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
/nix/store/h1cjcq31jnhl5g8z7vg16k1vhmyadani-dotnet-sdk-8.0.204/sdk/8.0.204/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.37
Error: building at STEP "RUN nix --extra-experimental-features "nix-command flakes" develop --command bash -c " dotnet workload restore -v detailed && dotnet restore -v detailed && dotnet build -v detailed"": while running runtime: exit status 1 |
Thanks. I reproduced the issue and this is the root cause: In my However, when the When I manually create a file at the latter location, the |
I think dotnet restore and dotnet workload update are two separate issues. Dotnet Info Output:
and dotnet workload update seems to use the correct path (sdk path)
|
The problem is that these two commands go look for the The |
But I don't even use dotnet restore at that point. And my workloads install fails nonetheless |
Then your issue is different from this reproducer: #37706 (comment). If you create an empty |
@Mr-MooMoo I assume this will fix your problem?
As I understand, the files in these packages are the binaries that Microsoft built. @anpin, as someone not familar with NixOS, I'm curious: does it require some sort of opt-in to use 3rd party binaries that were not built by the NixOS maintainers themselves? The Microsoft built SDK won't include a On the SDK side, it would be interesting to find out why |
@tmds all binaries are statically linked into /nix/store/-- even you build them yourself and it is read-only. In this particular case we use a symlink to join multiple SDK versions into /nix/store/-dotnet-core-combined then create the userlocal files and set this path to $DOTNET_ROOT (here are contents_of_dotnet_root.txt) . As you pointed out the big question is why dotnet restore / build /etc doesn't respect the $DOTNET_ROOT while dotnet workload restore does. |
@anpin, I'm interested to learn this.
I don't think anyone does this, so it's not surprising you are running into some issues with this layout.
Per https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#net-sdk-and-cli-environment-variables, This doesn't say anything about SDKs. For NixOS, the .NET 8.0.300 SDK resides in a directory: Since the You can create that file in your packages as a temporary solution. |
Perhaps it would make sense to make |
Sorry for my late response (i am on holiday currently); I tried your suggestions @tmds but unfortunately they don't work. Steps:
So i guess (just a guess!) it's more likely that this is the problem (as mentioned before):
|
The error says you are trying to install where the SDK lives, that is: it doesn't do a I'm surprised that creating a
Can you write out the steps as commands so I can try to reproduce the issue? |
Just from a little glimpse in sdk-source: Workload-Installer seems to check if userlocal is present: But InstallState doesn't (just uses dotnetdir) So, as the command always fails with while trying to write "InstallState", that seems possible. Sure, I created my nix shell:
overlay.nix:
then run |
@Mr-MooMoo, I reproduced the issue. It is different from the one @anpin ran into with the 8.0.2xx SDK. @marcpopMSFT @dsplaisted @baronfel it seems that The issue can be reproduced with these commands (on any
|
@tmds thanks a lot for investigating and providing simple repro steps |
Triage: I believe we're tracking the two core issues already through #41420 and dotnet/source-build#3242. Closing assuming those are tracking the issues identified here and we can reactivate if there's a third issue we missed. |
still fails with rc1 :( #41735 (comment) |
Same issue here with rc1 9.0.100-rc.1.24452.12 |
how about rc2 (released recently)? https://dotnet.microsoft.com/en-us/download/dotnet/9.0 |
Yeah, already saw that a new RC2 was released. I've installed the RC2 release and the MAUI workloads and it would build again. Somehow the workloads were lost, dotnet workload list returned nothing. |
For me RC2 does not fix it. Exactly the same as before. > dotnet --info
.NET SDK:
Version: 9.0.100-rc.2.24474.11
Commit: 315e1305db
Workload version: 9.0.100-manifests.4872d5d5
MSBuild version: 17.12.0-preview-24473-03+fea15fbd1
Runtime Environment:
OS Name: nixos
OS Version: 24.11
OS Platform: Linux
RID: linux-x64
Base Path: /nix/store/ckjmw8ahlv89vhn76rdqb04r7xkngz9c-dotnet-sdk-9.0.100-rc.2.24474.11/sdk/9.0.100-rc.2.24474.11/
.NET workloads installed:
[maui-android]
Installation Source: SDK 9.0.100-rc.2
Manifest Version: 9.0.0-rc.2.24503.2/9.0.100-rc.2
Manifest Path: /home/a/.dotnet/sdk-manifests/9.0.100-rc.2/microsoft.net.sdk.maui/9.0.0-rc.2.24503.2/WorkloadManifest.json
Install Type: FileBased
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0-rc.2.24473.5
Architecture: x64
Commit: 990ebf52fc
.NET SDKs installed:
9.0.100-rc.2.24474.11 [/nix/store/fa8svf3jpqs5jpx9jmigkvcpc7vflyqx-dotnet-core-combined/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/nix/store/fa8svf3jpqs5jpx9jmigkvcpc7vflyqx-dotnet-core-combined/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [/nix/store/fa8svf3jpqs5jpx9jmigkvcpc7vflyqx-dotnet-core-combined/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/nix/store/fa8svf3jpqs5jpx9jmigkvcpc7vflyqx-dotnet-core-combined]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
> dotnet workload list
Installed Workload Id Manifest Version Installation Source
-----------------------------------------------------------------------------------
maui-android 9.0.0-rc.2.24503.2/9.0.100-rc.2 SDK 9.0.100-rc.2
Use `dotnet workload search` to find additional workloads to install.
> dotnet build
Determining projects to restore...
/nix/store/ckjmw8ahlv89vhn76rdqb04r7xkngz9c-dotnet-sdk-9.0.100-rc.2.24474.11/sdk/9.0.100-rc.2.24474.11/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 [/home/a/projects/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
/nix/store/ckjmw8ahlv89vhn76rdqb04r7xkngz9c-dotnet-sdk-9.0.100-rc.2.24474.11/sdk/9.0.100-rc.2.24474.11/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/a/projects/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
Build FAILED.
/nix/store/ckjmw8ahlv89vhn76rdqb04r7xkngz9c-dotnet-sdk-9.0.100-rc.2.24474.11/sdk/9.0.100-rc.2.24474.11/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 [/home/a/projects/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
/nix/store/ckjmw8ahlv89vhn76rdqb04r7xkngz9c-dotnet-sdk-9.0.100-rc.2.24474.11/sdk/9.0.100-rc.2.24474.11/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/home/a/projects/maui-on-nix/src/MauiOnNix.csproj::TargetFramework=net8.0-android]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.76
> ls -al $DOTNET_ROOT/metadata/workloads/9.0.100/userlocal
.r--r--r-- 0 root 31 Dec 1969 /nix/store/fa8svf3jpqs5jpx9jmigkvcpc7vflyqx-dotnet-core-combined/metadata/workloads/9.0.100/userlocal |
@marcpopMSFT would you mind re-opening this issue since it was not fixed? |
I created a new bug since the original issue for this should be fixed. We can follow up there. |
Describe the bug
I'm not able to restore/ build MAUI project targeting

net8.0-android
on linux. The message says I need to installnet8.0-android
even though it is already installed.To Reproduce
The repro is located here and it is using the nix package manager to setup developer environment with
dotnet
and userlocal files as per #18823.Exceptions (if any)
Further technical details
binlog.zip
The text was updated successfully, but these errors were encountered: