I am running Visual Studio on a Mac for .NET MAUI. I was playing around with some package versions following a Visual Studio update about a week ago, and now when I try to run my project on the Android Emulator, I get a message that says Cannot execute "[my directory path]/bin/Debug/net7.0-android/[my project name].dll
. The project still runs on the iOS Simulator without issue.
When I open Project Properties, I see the Android Target is now missing. It was previously shown on this screen.
I think this started when I tried to change the Target .NET Runtime
to .NET 8.0 for Android before I had .NET 8.0 installed. The Deploying to Device
output appears to be normal, although I admit I don't usually pay much attention to it and probably wouldn't recognize an anomaly.
I have attempted the following and none seemed to solve the problem:
I was able to solve my problem by following steps outlined in this video: https://www.youtube.com/watch?v=3lZldOqg5i0&t=525s
Before making any changes, when I ran dotnet workload search
in a Terminal window, I got this result which is missing maui-android
.
So I ran sudo dotnet workload install maui
and sudo dotnet workload install maui-android
and now I have this list:
I restarted Visual Studio and I was able to debug again with the Android Emulator and also publish for Android again.