Need help setting up VS on Mac

MonoGame doesn’t work as expected in Visual Studio 2022 for Mac when I want to debug a new MonoGame iOS or Android project. I use the templates in VS 2022 for Mac to create the MonoGame projects.
When I right click on my Android/iOS project and choose Properties then not all the Build options are displayed.
iOS build options:


I get this error message when I want to debug my MonoGame iOS project on my iPad:
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.0.523/tools/msbuild/iOS/Xamarin.Shared.targets(3,3): Error: Could not find any available provisioning profiles for TestProjectios on iOS.

Android build options:


On Android it works if I create a new blank MonoGame Android project from template.
But I get this error message when I use my proguard.cfg file from Visual Studio 2019 for Mac in a new MonoGame Android project in Visual Studio 2022 for Mac and when I want to debug it on a device:
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.476/tools/Xamarin.Android.D8.targets(5,5): Error: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/myname/.nuget/packages/xamarin.google.guava.listenablefuture/1.0.0.5/buildTransitive/net6.0-android31.0/../../jar/guava-listenablefuture.jar : com/google/common/util/concurrent/ListenableFuture.class

I have installed Visual Studio 2022 for Mac 17.3.8 (build 5) and I have installed(Install from file…) MonoGame.Templates.VSMacExtension_3.8.1.303.mpack in the Visual Studio Extensions. But it always displays the extension as disabled:

Could someone create a tutorial for setting up MonoGame in Visual Studio 2022 for Mac?

1 Like

hey,
if Monogame models do not appear
try :

dotnet new --install MonoGame.Templates.CSharp 

otherwise you can create your projects from the command line in the meantime:

dotnet new mgdesktopgl -o MyGame
dotnet new mguwp -o MyGame
dotnet new mgios -o Mygame
dotnet new mgandroid -o Mygame

-Check if you have the latest Xcode version for IOS
-Change Android target 31 minimum

It’s not working. The MonoGame extension is still displayed as disabled after using: dotnet new --install MonoGame.Templates.CSharp
But the templates are displayed in Recent and I can use them to create new projects:

And more important, not all the build options are displayed in the Build menu, for example iOS Bundle Signing is missing. What can I do so that all the build options are displayed in an Android/iOS project?

Do you have the M1 chip?

I have an 3,7 GHz 6-Core Intel Core i5.

That sounds like you didn’t create a provisioning profile. You can’t even test your app on a real iPhone unless you create one. You should be able to run it in the simulator though.

It’s not working on the iOS simulator. The simulator is displayed but then debugging automatically stops but I don’t get an error message. My application is not installed on the simulator.
How can I add my provisioning profile to my iOS project if not all the build options are displayed? It looks like this when I right click my project–>Properties–>Build:

What’s wrong with that screenshot you posted? That looks normal.
If you create a regular non-MG app, can you run that in the simulator?

I have the same problem with the simulator(iPhone 14 Pro Max iOS 16.1) when I create a blank Xamarin.Forms project from the VS 2022 for Mac template. The application is not installed on the simulator.
But I have more build options with the blank Xamarin.Forms template than with the MonoGame templates:


I don’t know why these build options are not displayed when I create a new MonoGame project and I don’t know if it is normal. But in VS 2019 for Mac Community I had the same build options than in the Xamarin.Forms project in my MonoGame projects.
How can I add a provisioning profile in VS 2022 for Mac to a MonoGame project?

Don’t bother with provisioning profiles for now, get it running in the simulator first.
Obviously you have a more basic, non-MG related, problem.
What about a regular non-Xamarin.Forms app, does that one launch?
Do you have Xcode installed? My next question would be, can you create and run an app from Xcode?

I have created a new project in Xcode(iOS–>App template) and it works on my iPad and in the iPhone 14 Pro Max iOS 16.1 simulator. I have Xcode version 14.1 (14B47b).

I have created a Single View App in VS 2022 for Mac and the project works on my iPad but it’s not working in the iPhone 14 Pro Max iOS 16.1 simulator, the same problem here with the simulator that the application is not installed. I have all the build options in this project:

Okay, so there’s some problem with VS for Mac itself. I don’t know what that could be.
You probably won’t find the answer in this forum, as it got nothing to do with MG.

have you tried uninstalling vs 2022 and reinstalling?

during the installation try to install the targets you need

This is an issue with the “.NET 6”.

iOS App project is not “.NET 6 (iOS)” but "Xamarin.iOS”.
On the other hand, MonoGame’s iOS project is “.NET 6”.

“.NET 6 (Android)” also has the same problem.

The solution is not to use “.NET6 / .NET MAUI”.
Unfortunately, “.NET6” is not yet at the actual situation level.
Microsoft has said that they will end support for Xamarin on May 1, 2024 and fully migrate to .NET MAUI, but I think this migration plan is doomed at the current level of perfection.

I moved VS from the Applications folder to the recycle bin and deleted it. After installing VS again, the same problems still exists. I have not yet tried to uninstall VS with the uninstall script.
But I can run iOS projects now on my iPad because I found out how to add Apple provisioning profiles to VS:
https://learn.microsoft.com/en-us/xamarin/cross-platform/macios/apple-account-management?tabs=macos

Installing the visual studio mac 17.5 preview version allows me to avoid a lot of problems
To test …

I have not yet tried 17.5 preview. I use now 17.4 and it displays all the build options for my Android and iOS projects. But the iPhone simulators are still not working.
Have you tried the iPhone 14 Pro Max iOS 16.1 simulator in 17.5 preview? Does it work?

I just tested it works

but I do not recommend using it for debugging because it requires a lot of resources I have an i5 like you with 3.7 GHz tuboboost
I recommend a version below to debug in any case it works

I get this error message when I want to install the MonoGame extension for Mac in 17.5 preview:

How can I solve this problem?