MonoGame inside your web browser

Hi, I can’t install the new bridge/web package as I don’t have Web Core. I’m running VS 2013. I’ve managed to download the MG bridge VS package using NuGet but ‘dotnet’ commands aren’t available. Can you suggest an alternative way please?

You can sideload VS17 or if your system meets the requirements, try VSCode [Same applies to VS17]

Yup, you need VS 2017.

Thanks for the help. Yep I had to install vs2017.
So I got it working. But when I came to integrating my existing code base I came across a major problem. The Bridge C# library uses its own version of mscorlib.dll I believe and as such it creates circular references with my existing code (which uses the standard libs such as system.dll, system.web.dll, entity framework, mvc etc. I could not for the life of me get them to work together due to conflicting references. The guys over at the Bridge C# project suggested I need to create a Bridge project and add all my code to that. Tried it, still couldn’t sort the problems. So… is there anyway you MonoGame guys will use another library or are you stead fast on Bridge? I’m having to look elsewhere for a C# to WebGL solution - probably Unity (which is sickenly complicated for what I want to achieve).


Hmmm, I wonder if I can get ModLab running in web browser, this might be interesting project.

We can potentially add Microsoft Edge to the supported list here soon…

1 Like

You might need to yell at me to implement a method or two. Oh that reminds me I need to update the nuget package, I’ve managed to fully fixup content loading.

Yes, lol.


I pulled together all of the bits on this topic I could find and wrote up a tutorial on how to get MonoGame running on a website with @harry-cpp’s fantastic WebGL package.

Hopefully it helps anyone who lands here like I did last week.


Is it possible to split the .js file into individual files, one per class or namespace
and then use ES6 modules to load them on demand?

e.g. “import {Vector2, Vector3} from ‘/modules/xna.monogame.Framework-module.js’;”
e.g. “import {Viewport} from ‘/modules/’;”


Expanding on the above…
Is it possible to seperate the mononogame.dll to it’s own .js file?
Then you could host it in the official MonoGame servers and everyone could reference it. Just like how Google is serving jQuery.

With this you will improve loading times, (assuming the monogame.js is found in the browser cache),
webapps can use the latest version,
and collect statistics about usage.

It already works like that:

GitHub repo:
Link to index.html which links the js lib:
Link to the actual min lib version, don’t use it tho as this is still in dev:

1 Like

Oh, that’s awesome :smiley:

Some of the information here is outdated.

Blazor now uses mono-wasm AOT to compile to webasm using llvm. It also still supports an interpreted mode for rapid prototyping.

Note that Blazor is really the app framework, you can use mono-wasm without Blazor, and probably want to in this case.

.net core 5 will support compile to webasm natively without the need to use mono

Hey, this is awesome and managed to display a few things on my web browser. But as I wanted to port a small game I made, I ran into a Specified method is not supported error. My game is quite simple and I think I won’t have any problem finding a workaround for this method… if only I knew which one !

Is it possible to know where my problem is? Thanks.

Here’s the full stacktrace :

System.Exception: Uncaught System.NotSupportedException: Specified method is not supported.
Error: Specified method is not supported.
    at ctor (
    at ctor.$ctor1 (
    at new ctor (
    at Function.GetGLFormat (
    at $ctor1.PlatformConstruct (
    at $ctor1.$ctor3 (
    at new $ctor1 (
    at ctor.Read$1 (
    at ctor.Read (
    at ctor.InnerReadObject (

Okay, by commenting/uncommenting lots of lines, I just found out that loading spritefonts and/or sounds is the problem.

    Font = content.Load<SpriteFont>("Font");
    Click = content.Load<SoundEffect>("Click");
    Song = content.Load<Song>("Music");

These line are my problem, how should I proceed to add sounds and spritefonts into the web version?

at Function.GetGLFormat (

Font = content.Load(“Font”);

Maybe it’s related to the texture compression / texture format. For start, change the Compression of SpriteFont to ‘Color’ to see if it’s working.

Yes, jsut set texture compression to color and it will work.



Is there source/build instructions for this demo? I have a MonoGame project and would like to try to port it to web!


I’ve been meaning to check this out for a while and finally got around to it. Alpha or not. This rocks!! Good job @harry-cpp . I just ported one of our monogame based games. I expected a lot of issues during the port, but I was surprised by how much was already working.
Take a look at choose play as a guest and take a look at the “High Noon Saloon” game. Speed was not much of an issue since the game is designed to run on low cost android tablets.

There are a few issues I have found with sound effects especially when exiting and restarting the game. And it needs the ability to resize on the fly.

I am pretty familiar with the monogame source code since I use a customized version to integrate into our platforms. I think I will grab the source see if I can figure out what is going on.

Also thanks to @craftworkgames on the excellent info for getting things setup.

Again awesome job guys.