Reputation: 449
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:
Upvotes: 5
Views: 1455
Reputation: 452
I just had this problem with a Xamarin Android App and I solved it by deleting all of my user settings located under /Users/[USER]/Library/Preferences/VisualStudio
Not an optimal solution (all keybindings gone etc) but at least i can debug again.
The problem started after enabling the setting Other/Preview features/Use .NET 8
but didn't go away after disabling this.
Upvotes: 0
Reputation: 449
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.
Upvotes: 5