MGCB editor with VSCode 3.8.1

Having hard time getting the editor to run. Using VSCode.
(Don’t have Visual studio, don’t have the extension.)

I got the new templates (via CLI), made new test project.
(Including the .config/dotnet-tools.json file.)

Got the tool:
dotnet tool install --global dotnet-mgcb-editor
You can invoke the tool using the following command: mgcb-editor
Tool ‘dotnet-mgcb-editor’ (version ‘3.8.1.303’) was successfully installed.

Everything builds and run. But I can’t open the content editor.

Running the command: mgcb-editor
Gets this error (in a fancy window, not terminal):

System.IO.FileNotFoundException: Could not load file or assembly ‘PresentationFramework, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The system cannot find the file specified.
File name: ‘PresentationFramework, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at MonoGame.Tools.Pipeline.Styles.<>c.b__0_0(MenuBarHandler h)
at Eto.Style.<>c__DisplayClass13_01.<Add>b__0(THandler w) at Eto.DefaultStyleProvider.<>c__DisplayClass9_01.b__0(Object widget)
at Eto.DefaultStyleProvider.ApplyStyles(Object widget, String style)
at Eto.DefaultStyleProvider.Eto.IStyleProvider.ApplyStyle(Object widget, String style)
at Eto.Widget.OnStyleChanged(EventArgs e)
at Eto.Widget.set_Style(String value)
at MonoGame.Tools.Pipeline.MainWindow.PipelineMenuBar…ctor() in D:\a\MonoGame\MonoGame\Tools\MonoGame.Content.Builder.Editor\MainWindow.eto.cs:line 24
at MonoGame.Tools.Pipeline.MainWindow.InitalizeMenu() in D:\a\MonoGame\MonoGame\Tools\MonoGame.Content.Builder.Editor\MainWindow.eto.cs:line 287
at MonoGame.Tools.Pipeline.MainWindow.InitializeComponent() in D:\a\MonoGame\MonoGame\Tools\MonoGame.Content.Builder.Editor\MainWindow.eto.cs:line 60
at MonoGame.Tools.Pipeline.MainWindow…ctor() in D:\a\MonoGame\MonoGame\Tools\MonoGame.Content.Builder.Editor\MainWindow.cs:line 46
at MonoGame.Tools.Pipeline.Program.Main(String[] args) in D:\a\MonoGame\MonoGame\Tools\MonoGame.Content.Builder.Editor\Program.cs:line 50

Any hints?
Thanks.

1 Like

“Fixed” by installing Visual Studio 2022 and the extension…
Then using VSCode.

(So I guess something got into the system that was missing, no idea what it was)

You don’t need to install MGCB as a global tool (--global). Actually you don’t need to install it at all, it is not recommended anymore and you will likely run into versions mismatch doing so.

All you have to do to access tools with 3.8.1 is to run dotnet mbcg or dotnet mgcb-editor from the project directory (it won’t work outside of the project’s directory).

Regarding your initial issue, it was likely a broken .NET installation (the extension doesn’t install anything, so it’s definitely not linked to it).

Running the command now (from the project folder root, having the config, content, etc.), opens the editor, but it is blank:

Any tips how to auto-open the project’s content.mgcb?

EDIT: nevermind, sorted
Name: MonoGame Content Builder
Description: Edit MonoGame Content Builder files in VSCode
VS Marketplace Link: MonoGame Content Builder - Visual Studio Marketplace

Not with VS Code. With VS Code you will have to at least manually open your .mgcb once, or provide it as a paramter.

The extension won’t work with VS Code, it is only meant for VS 2022.

BTW, I’m using VS2022 and I have my content file together with a bunch of assets in a separete folder out of the project folder so I use the content file as a link. In this case, if you double-click the icon in the Solution Explorer the mgcb-editor is not being lanuched. Not a big problem, I can run dotnet mgcb-editor and survive. After experimenting a bit with so many commands it happened that mgcb files have no longer the MonoGame icon.

Fresh install of VS 2022 (Win10) and monogame with all of 3.8.1.303 _ I’ve tried a lot of things now. Also, if I try running MGCB-editor.exe directly, I get what looks like a CLI window which disappears immediately. I’m out of possibilities. I tried all evening. I’ll try again tomorrow and see what I figure out. ;p

This is a bit mysterious to me but I finally got it working.
Earlier, I tried CLI from VS 2022 typing: dotnet mgcb-editor
And it just said it doesn’t exist (so weird). [also after tried reinstall of .NET 6 by itself]
I went to regular command prompt and navigated to the folder and tried the same thing with a different result:
C:\Users\Jei\source\repos\Fysix\Fysix\Content>dotnet mgcb-editor
Run “dotnet tool restore” to make the “mgcb-editor” command available.
And so:
dotnet tool restore
… successful
So now, when I double click on Content.mgcb editor
it works…
It’s odd that didn’t work before but now it does. Maybe something to do with reinstalling .NET6 ?

Anyway, I thought I’d post my experience in case someone else had run into this issue and could use this information to help them.

The installation of the MGCB Editor confuses me heavily in 3.8.1. Previously, I just downloaded the exe and then I opened .mgcb files using it to get access to the GUI.

Now, I’m only meeting errors left and right trying to get this installed.

e.g. when I try to install dotnet-mgcb-editor via Nuget “NU1202: Package dotnet-mgcb-editor 3.8.1.303 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package dotnet-mgcb-editor 3.8.1.303 supports: net6.0 (.NETCoreApp,Version=v6.0) / any”

It’s not compatible with net6.0, only with net6.0? Huh?

I tried finding the .exe in what I believe to be the installation folder, C:\Users\Oblotzky.dotnet\tools.store\dotnet-mgcb\3.8.1.303, but there is no exe to be found there unlike previous versions (e.g. 3.8.0 had an exe here).

Any help would be greatly appreciated, can’t figure out how to compile content atm.

1 Like