libmojoshader_64.dll is missing

So I have this project using Windows GL and it compiled just fine before upgrading to windows 11 and now it fails to compile two shaders saying this file is missing. I googled it and there are posts about it going all the way back to 2015 but no clear solutions. Mainly just “that’s weird” and no follow ups.

I’ve installed ‘vcredist_x64.exe’ aka “Visual C++ Redistributable for Visual Studio 2012 Update 4”
as well as ‘DirectX SDK - (June 2010)’.

My Visual Studio 2022 Professional is up to date. The MGCB editor was installed via command line and it does run and load my content file as well as the contents but when it launches it says “Catastrophic failure HRESULT 0x8000FFF”, then compiles everything but those two shaders just fine.

NuGet shows that I am running the latest versions of DesktopGL and Builder.Task.

Finally I copied the files over to my other windows 11 PC and after VS2022 downloaded all the NuGet stuff it builds just fine with no complaints.

Hey @Junkman,

The “Catostrophic Failure” error you’re seeing, we’ve been seeing reports from othes seeing that as well in the MonoGame discord.

That error specifically, if you look it up, there are tons of results that all point to different VS versions that eventually updated and got fixed.

I cant say 100% for certain this is a VS issue and not a MonoGame issue, but at this point im thinking it is a VS issue.

If you run the command

dotnet mgcb ./Content/Content.mgcb

from a command line/terminal within the project directory, outside of VS itself, will it build fine? If so, then its 100% something borked in Visual studio (most likely)(probably)

Also as a last question, since you mentioned you installed the MGCB Editor via command line, did you install the MGCB editor as a global dotnet tool using the -g flag? If so, it should not be global, see here for more info

Ok so I kept having endless problems with this so I nuked VS2022 and did a clean install. On a clean install I tried to install the NuGet packages but it said they were already installed so I guess it doesn’t get uninstalled with the rest of VS.

So then I went on a big hunt to delete all things NuGet, I cleared the cache but that didn’t do anything to the packages. I deleted all the folders in my profile and in appdata and then did a repair on VS2022.

I reinstalled MonoGame with the NuGet command lines and did make the tool global, all that went well. The tool no longer has the catastrophic failure but it also can’t build those shaders with the missing DLL.

I am on the verge of doing a full reinstall of windows at this point since I haven’t been able to work in days. :sweat_smile:

So, the shader dll is part of another tool thats listed in the dotnet-tools.json manifest for the MonoGame project.

This is why its no longer recommended to install it as a global tool.

NuGet is cached in %UserProfile%\.nuget\ directory

Hey @Junkman, just had someone in the MG discord that had the “Catostrophic failure” error message again. This time I had them try rolling back the version of VS to the previous version. Once they did the error went away. So it does appear that this is an issue with the most recent release version of VS.

How do I get the shader dll? I tried a rollback and the tool no longer crashes but the dll is still missing and shaders fail to compile :confused:

Are you still using the tool as a global installed tool? From your previous reply

If this is the case, I will need to reiterate that the tool should not longer be installed as a global tool. I’ll link again to my post detailing this information here

For the MGCB Editor to function properly, you’ll need to include all of the tools that are outlined in that dotnet-tools.json file that I have in that post. Specifically the dotnet-mgcb tool is the one that contains the libmojoshader_64.dll

I would highly recommend that you do not use this as a global tool and instead keep it as a local tool. Setting this up as a local tool is explained in the post I linked above.

OK. I finally got this to work.

Microsoft Visual C++ Redistributable for Visual Studio 2013

:man_facepalming:

Unfortunately, the pre-built dependency native dll’s have dependencies of their own, that may not be included in the nuget packaging.

So thank you, the Install page needs to express the prerequisites of all pre-compiled binaries for all platforms.

But this is factually incorrect. All needed dependencies are included in the dotnet tool nuget packages as long as you are setting it up the proper way which is as a local dotnet tool and not a global dotnet tool.

The MonoGame templates provide the dotnet-tools.json manifest that includes all necessary tools, including their dependencies.

You don’t need external dependencies installed.

I guess to prove a point, I just reformatted my PC, so this is a fresh WIndows 10 installation. I do not have the Microsoft Visual C++ Redistributable for Visual Studio 2013 install, (though I have the MIcrosoft Visual ++ Redistributable 2015 which is included as part of the initial WIndows 10 install)

With this, and using the MonoGame templates as expected with the local dotnet tools and not global tools, I am able to compile .fx with no issue and run the game with no issue or need of external dependency installation. This particular example being a simple 2D light shader

3 Likes

I’m on Windows 11 on all my machines so it might just be different. I just got a new work laptop and Monogame refused to build until those 2013 files were installed :person_shrugging:

The MonoGame templates provide the dotnet-tools.json manifest that includes all necessary tools, including their dependencies.

That is a false statement.

https://github.com/search?q=repo%3AMonoGame%2FMonoGame%20dotnet-tools.json&type=code

Dot net by itself can run in user-space, but a binary installer requiring elevated privileges, has never been asked for in my experience with Monogame.

I am sure it is possible, but it is not done within MonoGame.

The tools manifest generated by the templates include

  • dotnet-mgcb
  • dotnet-mgcb-editor
  • dotnet-mgcb-editor-windows
  • dotnet-mgcb-editor-mac
  • dotnet-mgcb-editor-linux

The OS specific ones are bootstraps to launch the dotnet-mgcb-editor on that system. This is just the front end GUI. When you tell it to build in the GUI or by command with dotnet mgcb ./Content/Content.mgcb (which is run automatically on project build by the MonoGame.Framework.Builder.Task NuGet) then it uses the dotnet-mgcb tool.

What does that tool contain? The dependencies it requires that are packaged with it, including one libmojoshader_64.dll

https://nuget.info/packages/dotnet-mgcb/3.8.1.303

After doing a little digging and helping someone out in discord, I’ve discovered that I’m incorrect. The current libmojoshader_64.dll that is distributed with the dotnet-mgcb package was not statically linked when built with its dependencies.

image

It retains the dependency on MSVCR120.dll which is why installing the redistributable fixes this.

This is not how it should be, and there is work being done currently for all dependencies that will ensure future releases do not have dependencies like this requiring an additional install.

My apologies

2 Likes