craftworkgames / MonoGame.Extended

Extensions to make MonoGame more awesome
http://www.monogameextended.net/
Other
1.44k stars 325 forks source link

Failed to create importer 'BitmapFontImporter' #808

Closed jakeklassen closed 1 year ago

jakeklassen commented 1 year ago

I'm trying to get a bitmap font rendering in a simple demo.

I've searched this in the repo, but oddly others have issues with MGCB. Mine builds just fine and the importers are selected correctly after referencing MonoGame.Extended.Content.Pipeline like the documentation calls for. My issue is when building or running the application.

When running or building the app (via dotnet build or dotnet run) I get the follow error:

❯ dotnet build
MSBuild version 17.4.3+7e646be43 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  Failed to load assembly 'C:/Users/jklas/.nuget/packages/monogame.extended.content.pipeline/3.8.0/tools/MonoGame.Extended.Content.Pipeline.dll': Unable to load one or mo
  re of the requested types. Retrieve the LoaderExceptions property for more information.
  D:/workspace/gamedev/monogame-mgdesktopgl/Content/Font/pico-8.fnt
D:/workspace/gamedev/monogame-mgdesktopgl/Content/Font/pico-8.fnt : error : Failed to create importer 'BitmapFontImporter' [D:\workspace\gamedev\monogame-mgdesktopgl\mono
game-mgdesktopgl.csproj]
  Skipping D:/workspace/gamedev/monogame-mgdesktopgl/Content/Font/pico-8_0.png
  Skipping D:/workspace/gamedev/monogame-mgdesktopgl/Content/Graphics/bunny.png
  Skipping D:/workspace/gamedev/monogame-mgdesktopgl/Content/Graphics/map.png
  Skipping D:/workspace/gamedev/monogame-mgdesktopgl/Content/Graphics/megaman-left.png
  Skipping D:/workspace/gamedev/monogame-mgdesktopgl/Content/Graphics/player-ship.png
C:\Users\jklas\.nuget\packages\monogame.content.builder\3.7.0.9\build\MonoGame.Content.Builder.targets(73,5): error MSB3073: The command "C:\Users\jklas\.nuget\packages\m
onogame.content.builder\3.7.0.9\tasks\netstandard2.0\../../build\MGCB\build/MGCB.exe /@:"D:\workspace\gamedev\monogame-mgdesktopgl\Content\Content.mgcb" /platform:Desktop
GL /quiet /outputDir:"bin\DesktopGL\Content" /intermediateDir:"obj\DesktopGL\Content"" exited with code 1. [D:\workspace\gamedev\monogame-mgdesktopgl\monogame-mgdesktopgl
.csproj]

Here are some package versions for reference:

<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
<PackageReference Include="MonoGame.Extended" Version="3.8.0" />
<PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.8.0.13" />

Any ideas what it could be?

Gandifil commented 1 year ago

Hm.... it's something interesting. I will try to reproduce this case. Now I can only advice to do it: https://community.monogame.net/t/error-in-pipeline-failed-to-create-importer-bitmapfontimporter/11783/4

jakeklassen commented 1 year ago

So I was able to fix this. I was modifying an older repo of mine which I think was not current with the newest Monogame dotnet template.

I simply updated and created a new repo using dotnet new mgdesktopgl, re-added Monogame.Extended and my assets. Builds and runs just fine now 👍

Hopefully that helps others.