Help with kni engine

Hi friends,

I’m wondering if anyone has experience using kni engine, a fork of MonoGame that allows for running in the browser via Blazor.

I’m not sure I understand the installation and build processes and would appreciate any pointers on how to get a project up and running.

I’ve tried cloning the repo and running one of the Blazor templates but am getting caught up on MGCB refs not being found.

FWIW my default state in MonoGame (outside of KNI) is wrestling with the MGCB, so I’m certain that some degree of user error is involved.

Thanks for any help!

Not sure about the Kni Engine, but what kind of issues are you having with MGCB?

1 Like

I have ported three of my existing monogame games to work in a browser with the kni build.

If you post up details of your issues I may be able to help as I did have to solve a few things due to current limitations of the kni build.

I had to switch to the kni version of the MGCB Edtior tool.

1 Like

Thank you so much for your reply! I’m receving an error thrown that Project “C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Content.Builder17.targets” was not imported by the project, due to the file not existing. I’ve had issues with the MGCB not having the correct paths before, but this is a template project, so I’m not certain what it’s looking for.

Thank you so much! My questions are pretty basic:

  • What’s the best way to get up and running with a project? I’ve cloned the repo and have been trying to run the “BlazorGLApplication” template, but am getting hung up on the MGCB not finding dependencies (please see previous post). Is there a simpler way to go about this or is it standard practice to build from source?

  • The template uses $safeprojectname$ for its namespace; can I just switch that out for a name without special characters?

  • I’m using GeonBit.UI (a UI library) in my MonoGame project. Are there any foreseeable issues for bringing a library like this into KNI?

  • Any other issues or gotchas I should be aware of?

Thanks again!

I just created a new project using the following steps:

In Visual Studio create a new project and select the template highlighted below:

Choose a name and folder for the new solution:

I then build the solution and got the error you mentioned above:

However, the solution does run in Chrome and produce the default cyan background:

I hope this gets you up and running.
You can add in your own classes once you get this far.
However, any third party libraries are likely to cause issues unless they are WebASM compatible.
If you hit a problem you can use F12 to view the issue details in the Chrome debugger.

1 Like

Thank you so much for taking the time to post this! How did you get the KNI templates to populate in VS? Did you export them from the templates provided from the repo?

Thanks again!

You need to install the SDK from here.
This will install the VS templates, the content building tools and .targets and the mgcb editor. The workflow is similar to MG 3.7 and prior.

VS2022 doesn’t seem to show new templates and it takes a couple of restarts for the templates to show. If you have this issue you can run “devenv /updateConfiguration”.

Third party libraries have to be re-build against the KNI libraries.


Ah, got it. I knew I was missing something. Thank you so much!

1 Like

I also found that if your “Documents” folder is in a different location than “C:\Users”, you then need to copy the templates to “C:\Users<user>\Documents\Visual Studio\Templates” for them to be recognised.
Or make sure your “Templates” location setting is “looking” in the right place.

1 Like