My project was working fine, when this error occurred on a unrelated debug recompile. Not sure where to look. Am I missing a reference?
Hope someone can point me in the right direction.
Thanks.
This is strange. I no longer get this error.
Have had other strange errors that just disappear. My project files are on OneDrive. Maybe files are not found when it is syncing???
Thanks.
This error has cropped up from time to time and it’s still unclear to me exactly why it happens.
I believe there’s some quirky thing going on in the MonoGame Content Pipeline.
My general recommendation is to make sure you’re using the latest version of MonoGame (most importantly the Pipeline Tool) because I think the bug exists there. However, every time someone reports this issue the symptoms seem to be slightly different so it’s quite confusing.
I did some digging, after updating to Content Pipeline v3.7.0 from v1.1.0 with NuGet, this is what I get when executing build command manually:
H:\Visual Studio\Projects\Test\Test\Content>"C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"H:\Visual Studio\Projects\Test\Test\Content\Content.mgcb" /platform:Windows /outputDir:"H:\Visual Studio\Projects\Test\Test\Content\bin\Windows" /intermediateDir:"H:\Visual Studio\Projects\Test\Test\Content\obj\Windows"
Build started 09-Sep-19 05:06:08 PM
Failed to load assembly 'H:/Visual Studio/Projects/Test/packages/MonoGame.Extended.Content.Pipeline.3.7.0/lib/netstandard2.0/MonoGame.Extended.Content.Pipeline.dll': Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
H:/Visual Studio/Projects/Test/Test/Content/fonts/gui.fnt
H:/Visual Studio/Projects/Test/Test/Content/fonts/gui.fnt: error: Failed to create importer 'BitmapFontImporter'
Skipping H:/Visual Studio/Projects/Test/Test/Content/fonts/gui_0.png
Build 2 succeeded, 1 failed.
Time elapsed 00:00:00.14.
After plumbing around with a debugger I’ve managed to print out what’s going on internally:
Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft.Xna.Framework.Content.Pipeline.ContentStatsCollection MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.get_ContentStats()'.
at MGCB.BuildContent.Build(Int32& successCount, Int32& errorCount)
at MGCB.Program.Main(String[] args)
The exception is thrown by MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ResolveAssemblies()
My project targets .NET 4.7.2, my MonoGame version is 3.7.1 (was tested on 3.7.0 as well), my MonoGame.Extended version is 3.7.0 - NuGet latest at the time of writing.
What’s baffling is that this property exists in the decompiler view
EDIT:
Here’s some more info on the subject, as it seems assemblies are being loaded from a directory where lib from NuGet is located. I’m even more confused as I keep getting the feeling that it’s a user fault?
Call stack: > MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ResolveAssemblies( - Pastebin.com
Contents of LoaderExceptions at the top of the call stack: - LoaderExceptions {System.Exception[0x0000000F]} System.Exception[]+ [0] {S - Pastebin.com
EDIT 2:
Looks like I’ve solved the problem for myself. I had to manually add the following to the mgcb file.
/reference:..\..\packages\MonoGame.Extended.3.7.0\lib\netstandard2.0\MonoGame.Extended.dll
/reference:..\..\packages\MonoGame.Extended.Tiled.3.7.0\lib\netstandard2.0\MonoGame.Extended.Tiled.dll
/reference:..\..\packages\MonoGame.Extended.Content.Pipeline.3.7.0\lib\netstandard2.0\MonoGame.Extended.Content.Pipeline.dll
That got it building again.
However, after doing that, I was experiencing the issue that got solved in here:
Thanks for the info @Ciastex
I’ve been working on this problem when anytime I get a spare moment and hopefully it’ll be smoothed out when we release version 3.8
Unfortunately, it’s a bit of a multifaceted problem and everytime I think I’ve come close to a good solution I run into something else that makes it a little bit more complicated. The behavior of MonoGame and NuGet are both contributing to the problem (and the behavior has changed over the years) which makes this considerably more difficult.
Worst case, we might have to fall back to having a README file that explains the issue and how to work around it. I think I can get the README to display when the NuGet package is installed, so at least it’ll be in your face rather than scattered across the internet.
Does anyone know how to solve this issue?
Its happened for me after downloading a project from git.