Creating A Barebones MonoGame Project
Rider experience: brand new (build: EAP Rider RS-144.4757)
C# Experience: Dabbling with Unity3D
Creating a plain MonoGame project ended up being fairly easy once. This is just for setting things up for the most simple of projects: what the MonoGame template creates in Visual Studio. My goal was to only use Rider and online resources; I didn't want to use VS at all.
- Create an Empty Project - in my case, I called it Sandbox.
- Use NuGet to find Monogame.Framework.* and choose the operating system you're using; in my case, for Windows I chose WindowsDX.
- Visit http://www.gamefromscratch.com/post/2015/06/15/MonoGame-Tutorial-Creating-an-Application.aspx and have a look at the code automatically generated for Visual Studio.
- Create the Program.cs file using the code at the URL. In my case, I had to replace the namespace with Sandbox and comment out the #if and #endif lines. (aside: anyone know why those might not work in Rider? Or might it be an external configuration/limitation?)
- Create the Game1.cs file using the code at the URL. Again, I had to replace the namespace with Sandbox.
From here I was able to build and run the project with the Cornflower Blue window popping up.
Enjoy!
Please sign in to leave a comment.
The problem with #if lines is most likely that the [correct] conditional compilation constants are not defined.I have failed to locate any place where they could be defined for the compilation so my assumption is that it is not yet implemented/depends, as per your guess, on an external file.
The rawest solution would be to pass /d flags to the compiler (as per here: https://msdn.microsoft.com/en-us/library/x435tkbk(v=vs.100).aspx ) but, again, I failed to find anything about this.
Edit: Also found this bug report: https://youtrack.jetbrains.com/issue/RIDER-670
And posted this feature request: https://youtrack.jetbrains.com/issue/RIDER-1104
Until the functionality is added directly to Rider, you can manually edit the .csproj file to add the required compilation constants to the DefineConstants msbuild property. This should be in the format "DEBUG; TRACE; WHATEVER". See this msdn page for more details.
Ey, welcome to the future, 2018! Most of the directions above still apply, and the way to get the conditional constant stuff working in the current Rider is to follow the directions here. Namely, right-click your project, choose Properties, choose the configuration you want (e.g. Debug, Release), and then add `WINDOWS` to the "Define constants" option.
Hi, now you can use templates.
Install them via the command :
After that, when you create a new project from Rider, on the left side, you have option to create a monogame project from a template.