šŸ‘½ Setting up Visual Studio 2022 at the end of 2022

The original thing:

Click to see

So, I have had to step back again for a while and have had the urge to get back to coding again, so, I was wondering, should I write yet another guide for the fresh meat, err I mean, Forum Members, [cough-cough] [Halloween lol].

I am on a fresh system and figured I may as well document each stage of setup, but keep in mind, that for the time being, I am a UWP dev, however, that may soon change depending on how things develop in the next Windows OS updateā€¦

So, do chime in, the buffet is waiting, I mean, say hi and add to the interest list, and I shall cook up, I mean, write up a guide for you beginners so that you might go about coding with the all too brilliant, http://www.MonoGame.Rocks I mean MonoGame.Net.

You may also pen in a request for anyone to write up a guide for your chosen alternative OS, and someone may find the time to make one in a new thread too.

TL/DR
So, I will be making one anyway, but it could take a few days.

Happy Coding and welcome to all the newcomers of recent.

PS.

Click my username and hunt for the old threads I posted for some guides for XBOX and UWP setups and tips. I also have a useful links thread, which is full ofā€¦ useful links.


So, where are we, let me seeā€¦

What do we need to do:

ā€“ Purchase a box of tissues [optional]
ā€“ Obtain Visual Studio and install it
ā€“ Obtain MonoGame and get it set up
ā€“ Run our first project
ā€“ [1/2] Come back to the forum and boast in a new thread how we are super happy that it works [and ask for what to try next] [optional]
ā€“ [2/2] Come back to the forum and scream in a new thread how we are upset that it went wrong [and ask for help] [optional]

As you can see, we have a tremendous amount of work ahead of us, so let us beginā€¦

For the first thing we hit a search for ā€˜Visual Studioā€™ and get this page [hopefully]:
Visual Studio: IDE and Code Editor for Software Developers and Teams (microsoft.com)

Where most of us mere mortals will download the community edition, those pesky corporations will probably download the enterprise one, pft. show-offsā€¦

Assuming the page still looks like the aboveā€¦ clickety on that oneā€¦

Moving onā€¦

Once the installer downloads, run it and you should see thisā€¦

image

Donā€™t worry if you donā€™t just note how long ago this guide was written and hit a request for a newer guideā€¦

Click Continueā€¦

image

Let it do its thingā€¦

Once this completes, you may get thrown up a screen looking something like the following:

Scroll down a little to discover the two on the right sideā€¦

Specifically:

image

Tick these twoā€¦

image

Like soā€¦

Now, we want some key extra bitsā€¦

At the top, click on ā€˜Individual Componentsā€™

image

Scroll down the list you find here to this part:

Select Class Designer, Dependency Validation, LINQ to SQL Tools, NuGet targets and build tasks, optionally, DGML editor and Help Viewerā€¦

image

Oh, and alsoā€¦ scroll further down toā€¦

The emulation thingy, only if you need them, if you plan to emulate some devices, you will require one or both of these:

image

Scroll down further to Games and graphicsā€¦

image

Select ā€˜Graphics debugger and GPU profiler for DirectXā€™

Side note, GitHub is built into Visual Studio nowā€¦

If you donā€™t know what a Git is, umm, donā€™t worry about it for nowā€¦ it will come up in a discussion at some pointā€¦ speaking of discussions, have you been to the MG Discord yet?

Discord link

It is teaming with things that convert caffeine and pizza, into gamesā€¦

See what I mean?

Anyway, where were weā€¦

Oh yesā€¦

If you scroll to the bottomā€¦

image

You should see something like thisā€¦ err the image aboveā€¦

Select the latest SDK as well as the selection that is preselectedā€¦

image

I like my choicesā€¦

Click Installā€¦ if you dare:

image

You can cry at this moment in time if you are on a limited bandwidth lineā€¦ if so, reduce the selection of SDK kits to save a bitā€¦ or only choose the .NET or the UWP package from earlierā€¦ if you only plan to use one of themā€¦ did I forget to mention buying some tissues?

At this point, sit back, relax, make a cuppa :tea: and did you notice the wiz kids over at Visual Studio made the download way smaller for the download? see?

Perhaps save on buying that tissue box I guessā€¦

Up to you to allow it to start after installation, but it makes starting it easier, and you can pin the icon to the taskbar easily at that point too, when it opens that isā€¦

Time for a brewā€¦

I made a PG Tipsā€¦

Moving onā€¦

Nonessential ranting, click to expand

More tea I guessā€¦

Almost thereā€¦

Oh, come on!

Grabbed myself some JaffaCakes


image

You may or may not receive this notification, I did becauseā€¦ reasonsā€¦ moving onā€¦

Mine did not launch [I should but cannot be bothered right now, restart] so I launched it from the installer window, note, if you always start the installer first, you can always get notified about updates to Visual Studioā€¦

This is going to age like butterā€¦

image

This is new for meā€¦

I suggest signing in with an account you have either already, or intend to use for a developer account with Visual Studioā€¦

Side note, err be careful how you register, you cannot change emails used for a company back to or from an individual user account for publishingā€¦ to the storeā€¦ small side noteā€¦

Moving onā€¦ time to sign in and get that yummy MonoGameā€¦

Side note, this should be what you see when signing inā€¦

Be sure to be using 2FA [Two-Factor-Authentication]

Before I forget to mention itā€¦ take a second if you have it to support Monogame:
Great for PayPal users or people who donā€™t have PayPal
Donate | MonoGame
And that moderny Patreony thingy
https://community.monogame.net/t/monogame-patreon/17860/11

Nope, I am not paid to be here, at the time of this writing, and likely wonā€™t be for a long while, just spreading the good wordā€¦

Anyway, where were weā€¦

If you wander over to the Documentation pagesā€¦

Introduction | MonoGame Documentation

And then click on Getting Started and then Windows:

Setting up your development environment for Windows | MonoGame Documentation

We can see, we are already a step aheadā€¦ :wink:

Moving onā€¦

We want to focus on this part of the page:

Going back to Visual Studio once signed in, we should see this splash windowā€¦

Click on Continue without codeā€¦

image

This blue textā€¦

image

Below Create a new projectā€¦

Once Visual Studio opens, click Extensions and then Manage Extensionsā€¦

image

This window should open up:

In the search box, type MonoGameā€¦


Side note, notice the version you are downloading.

Click the fabled Download button:

Then look at the bottom of the window:

Click close and then close everything to do with Visual Studioā€¦ the installer can remain open for this bitā€¦

You should see this window popup:

image

Click Modifyā€¦

image

Wait for itā€¦

image

Maybe close that Visual Studio Installer now and run it againā€¦ click close, oh pin the Visual Studio Installer to your task bar if not already doneā€¦

Open the Installer again, and launch Visual Studioā€¦

So, we have VS, and we have MG, everything should be set up at this point, so, the last bit isā€¦ running our first project!

Once VS launches, clickā€¦

image

Create a new projectā€¦

If everything went well, you should see the following:

For the sake of this guide, we shall narrow down our choice to the UWP XAML project [Not sure where the CoreApp has gone, but we can safely ignore that for the time being]

If you narrow your choices to the below:

image

You should see the XAML option at the top as beforeā€¦ select thisā€¦ and click Nextā€¦

Give the project a name and click Create on the next screenā€¦

Mine is called the glorious ā€˜Project1ā€™ both for the Project and Solution namesā€¦

For completely fresh developer systems, you should see this warning:

image

Click the blue text, it should open the settings menu just hit the toggle switchā€¦

image

image

Select ā€˜Yesā€™

Close the Settings windowā€¦ return to Visual Studio and close the notice window by clicking Close.

You should now see this window [I shrunk it for simplicity]:

If yours looks like this at the top:

image

Click the Local machine button to run your code:

If it feels like nothing is happening for a long while, this will be because it is the first time you are running a project on the system for such development, look at the lower left of your screen:


After a while it should say:
image

See where it says ā€˜Restoring NuGet packagesā€™, let it do its magicā€¦ in a short while you should see the glorious CornFlowerBlue windowā€¦

And there you have itā€¦ you are good to go, and from here, you should probably take a look below to get started, the world is your canvas, go create!

Understanding the Code | MonoGame Documentation

I hope you found this guide useful; I may create one for Desktop development in the near future when the time calls for it.

Thank you and feel free to leave a comment below, if you have issues, post a new thread with screenshots of the point you are struggling with.

I may comb through this guide for typos at some point soon, but otherwise, not much will change.

Happy Coding and Welcome to the Community!

8 Likes

I take my hat off to you Mr Valentine, this is excellent stuff indeed.

I do have a question though, the getting started guide gives an Desktop OpenGL project as an example and for me, that doesnā€™t work. I created a thread about it but perhaps itā€™s in the wrong place to get any response:

https://community.monogame.net/t/trouble-with-getting-started-guide-for-version-3-8-1-303

Also others, like myself may be wondering where on earth the UWP Core template has gone? I do at least have a quick workaround to convert the Xaml UWP game to a Core UWP game:

  1. Unload the XAML Project (to enable editing of the csproj file).
  2. In every property group, seek out the ā€œDefineConstantsā€ tag and include, ā€œDISABLE_XAML_GENERATED_MAINā€, for eg:

<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP;DISABLE_XAML_GENERATED_MAIN</DefineConstants>

This will stop the automatic creation of a Program class that will run the xaml.

  1. Reload your project and create a new class, ā€œProgram.csā€ in the root. Type this code into that class:
using System;

namespace YOUR_NAMESPACE_HERE
{
    /// <summary>
    /// The main class
    /// </summary>
    public static class Program
    {
        /// <summary>
        /// The main entry point for the application
        /// </summary>
        static void Main()
        {
            var factory = new MonoGame.Framework.GameFrameworkViewSource<Game1>();
            Windows.ApplicationModel.Core.CoreApplication.Run(factory);
        }
    }
}
  1. If you notice that there is no ā€œContentā€ folder in your application, click on ā€œShow all filesā€ (top of solution explorer), open the ā€œContentā€ folder that is actually there but not included in the application and right click on ā€œContent.mgcbā€ and select ā€œInclude in projectā€. This should include the file and the parent ā€œContentā€ folder in your project for you.

  2. Optionally delete or ā€œexclude from projectā€ the files, ā€œApp.xamlā€ and ā€œGamePage.xamlā€ (and associated child files).

  3. Press F5 to see your Cornflower Blue screen running without any nasty Xaml in sight.

1 Like

Unfortunately I am not an OGL developerā€¦

I might have code for core setups somewhere, will try to dig it out and see if I can find itā€¦

Might be a while though.

I have found an issue with MG recently where you build a fresh template, but the references are all broken, go into the NuGet manager, update the included references to the latest ones, and build, should be working just fine.

Woops, responded to the wrong thread. Keep on with the good work!

1 Like

I figured this one out, you just need to visit the NUGET Manager and update anything in the update tab and then build.