0
\$\begingroup\$

I just encountered this kind of error when using the MonoGame Content Pipeline and it's my first time to use it to convert png to xnb files (I use a stand alone app for converting files to xnb in the past). I've done building spritefonts to xnb files and stuff like that in my previous MonoGame projects and I thought it would be similar but it turned out to be not the case.

So this is the error I have:

error: Importer 'TextureImporter' had unexpected failure!
System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1[Microsoft.Xna.Framework.Content.Pipeline.Graphics.TextureContent].Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import (System.String filename, Microsoft.Xna.Framework.Content.Pipeline.ContentImporterContext context) [0x00000] in <filename unknown>:0 
  at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent (MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent) [0x00000] in <filename unknown>:0

Is there a way to resolve this? Is there a tutorial of some kind I can follow to use the TextureImporter and the things I haven't yet understood on MonoGame's Content Pipeline with in-depth explanation about it?

\$\endgroup\$
  • \$\begingroup\$ Show us the relevant code that causes the error \$\endgroup\$ – dimitris93 Sep 7 '15 at 21:04
  • 3
    \$\begingroup\$ Do you have the latest version of the monogame content tool? I believe there was a bug related to this. (See github.com/mono/MonoGame/issues/4000 ) \$\endgroup\$ – Felsir Sep 7 '15 at 21:26
  • \$\begingroup\$ @Shiro There is no code involved as I am just trying to convert png files to xnb files using the MGCB. \$\endgroup\$ – arvicxyz Sep 7 '15 at 23:44
  • \$\begingroup\$ @Felsir I think I have similar MGCB version which is 3.5.0.344 that fails. I see... I'll look into this. Thanks man. \$\endgroup\$ – arvicxyz Sep 7 '15 at 23:48
1
\$\begingroup\$

You need to download and install the Visual C++ Redistributable Packages for Visual Studio 2013.


These two posts on https://github.com/mono/MonoGame/issues/3556 worked for me:

tomspilman:

Hum... the redist we need vcredist_x64.exe is only 7MB. If you download and run it from the command line:

vcredist_x64.exe -?

It tells you that it has /quiet and /norestart mode:

We should be able to embed this into the Windows installer fairly easily if we want.

Either that or we just add a note about it on the download site.

gms9rc:

Problem solved. Despite the fact that I am using VS2012 I needed to install the 2013 redistributable. Right here for anyone who comes across this problem https://www.microsoft.com/en-us/download/details.aspx?id=40784

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.