android: Could not resolve SDK "Microsoft.NET.Runtime.MonoAOTCompiler.Task"
Android framework version
net8.0-android
Affected platform version
.net 8.0.100
Description
Building android application with AOT enabled causes build issues with latest maui-android workload.
[ERR] ---: /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.113/targets/Microsoft.Android.Sdk.Aot.targets(25,5): error : Could not resolve SDK "Microsoft.NET.Runtime.MonoAOTCompiler.Task". 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.
[ERR] ---: /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.113/targets/Microsoft.Android.Sdk.Aot.targets(25,5): error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
[ERR] ---: /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.113/targets/Microsoft.Android.Sdk.Aot.targets(25,5): error : The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
Steps to Reproduce
Building existing application was working fine. Workload update on Azure pipelines caused build to fail.
When using a custom rollback-file workload.json file gives a different error:
[ERR] ---: /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.79/targets/Microsoft.Android.Sdk.Aot.targets(109,5): error MSB4044: The "MonoAOTCompiler" task was not given a value for the required parameter "CompilerBinaryPath". [/Users/runner/work/1/s/src/-----] [ERR] ---: /Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.79/targets/Microsoft.Android.Sdk.Aot.targets(109,5): error MSB4044: The "MonoAOTCompiler" task was not given a value for the required parameter "CompilerBinaryPath". [/Users/runner/work/1/s/src/-----]
(removed project info)
Did you find any workaround?
Workload rollback does not fix the issue, but creates different error.
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (7 by maintainers)
I would not recommend using multiple
$(Configuration)names like this, see:Since there are N potentially unknown properties you would need to set, no one know the exhaustive list of properties to set to get it right. I bet you don’t have
$(Optimize), set for example, which is fairly important for performance.If you need to set something for different environments, I would simply use a different property other than
$(Configuration)like:And then use
Conditionagainst your$(MySetting)property instead of$(Configuration).No issue with the vanilla project. I will compare and step by step try to break the vanilla project.