MonoGame Kickstarter

I can look into template creation but for it to work I guess I will have to make the dotnet tool work with the simpler templates first. In this case the mgdesktopgl and mgwindowsdx templates work but the mgandroid does not.

Is the import declaration correct? Or is my system setup / configuration not correct? Or what is the problem?

It is simply not possible at the moment to work with Xamarin.Android projects from the dotnet CLI until .NET 6 will be out in November 2021. See comments / discussion on GitHub https://github.com/MonoGame/MonoGame/issues/7350

So for MonoGame Kickstarter this means that while the mgdesktopgl and mgwindowsdx projects can be setup automatically by the script and everything just works for Android you would have to do some steps by hand.

Using e.g. Visual Studio 2019 the additional steps after running the MonoGame Kickstarter script (with Android project generation enabled to have it generate the project template) are:

  1. Open the solution and add the Android project
  2. Add a reference to the Android project to the NetStandardLibrary project
  3. Inside Visual Studio delete or exclude the Game1.cs from the Android project (it should be marked as not found already because it was deleted already on disk by the script)
  4. Right click the Android project and select Set as Startup Project from the context menu.
  5. Add to line 68 in the android.csproj an entry for the content from the NetStandardLibrary project so the shared content is available (replace SOLUTIONNAME !!!).
<ItemGroup>
  <MonoGameContentReference Include="..\SOLUTIONNAME.NetStandardLibrary\Content\Content.mgcb" Visible="false" />
</ItemGroup>

This way the Android project has content available from the shared content mgcb from the NetStandardLibrary project and also the default content which the template provides for Android projects.

I pushed everything to GitHub to the android branch if yomebody wants to test it. The script will also output the info about how to do the manual steps.

At this point the manual steps are not tested very much. I will test it if I have more time.

The mid term goal was to automate the setup of at least the project types mgdesktopgl and mgwindowsdx which MonoGame Kickstarter can provide. To have the mgandroid project to be included as well would have been nice but as described that is not available via the dotnet CLI yet until it will be supported by .NET 6 in November 2021. At least with some manual steps the remaining setup steps for an optional Android project can be done with Visual Studio 2019 as described.

As suggested there is also the alternative to the MonoGame Kickstarter script of creating a dotnet template. This way the automated setup of all projects should be possible if someone wants to create their own solution.

Interesting project. Does it target MG 3.8 or 3.7?

1 Like

Thank you, I hope the project is of some use for the community.

To answer your question the script is using the locally installed MonoGame templates. So it is using 3.8 or newer depending what is installed.

To install / update the dotnet CLI templates you only need one command

dotnet new --install MonoGame.Templates.CSharp

MonoGame Kickstarter checks at some point if the MonoGame templates are installed since they are required and prints the command if none are found.

The command is from the official MonoGame documentation.

Since MonoGame Kickstarter is at the core only just using the dotnet CLI you can modify and add or remove anything you want later from the generated solution and / or projects.