Table of Contents

Setting up your development environment for VSCode

A step-by-step guide for setting up your development IDE using VSCode

This is a guide on setting up your development IDE for creating games with MonoGame using Visual Studio Code. By following this guide, you will learn how to install the necessary tools for developing C# applications and configure Visual Studio Code with recommended extensions for C# development.

By the end, you will be fully equipped to start creating games with MonoGame using Visual Studio Code.

Install Visual Studio Code

  1. Open your web browser and navigate to https://code.visualstudio.com/.

    Download VSCode

  2. Click the Download for Windows button. This will redirect you to the download page where the installer will automatically download.

  3. When the download completes, run the installer and complete the steps to install Visual Studio Code.

Setting up VS Code for development with MonoGame

  1. Open Visual Studio Code

  2. Open up its terminal window (Ctrl + `)

  3. Run the following command to install MonoGame Templates

    dotnet new install MonoGame.Templates.CSharp
    

Install Visual Studio Code C# Extensions

To transform Visual Studio Code from a simple text editor into a powerful development environment for C# projects, you must install the Visual Studio Code C# extension. This extension enhances the editor by providing syntax highlighting, code analysis, IntelliSense, and other features that significantly improve the development experience and productivity when working with C#.

  1. Open Visual Studio Code.

  2. Click the Extensions icon in the Activity Bar on the left.

    Click Extensions

  3. In the Search Box type C#.

  4. Click Install for the C# Dev Kit extension. Installing this will also install the base C# extension.

Install C# DevKit Extension

(Optional) Install the "MonoGame for VSCode" extension

A community member has built a VSCode extension for VS code to enable:

  • Automatically install MonoGame templates
  • Create new projects from the file menu or command palette
  • Open the MGCB editor with the click of a button (very useful)

You can find this extension by following the steps above and searching for "MonoGame for VS Code" by r88.

Note

While not built by the MonoGame team, we regularly use this extension ourselves and fully support it.

Creating a new MonoGame project

  1. Open up an empty folder in Visual Studio Code

  2. Open up its terminal window (Ctrl + `)

  3. Run the following command to create an empty project for desktop platforms:

    dotnet new mgdesktopgl
    
  4. Once the files are created, open up the Game1.cs file and wait a second for the C# extension to load

  5. You can now press F5, select C# and then your projects name if Visual Studio Code asks you, and it should start up your brand new game!

Next Steps

Next, get to know MonoGame's code structure and project layout: