Problem updating pipeline extension to MG 3.8

I found a content pipeline extension that I’d like to use with some modifications. As part of these modifications I am trying to update it to .NET Core 3.1 and Monogame 3.8 and I am having some problems.

The project compiles, but when building content I get the error error: Failed to create importer 'FieldFontImporter'. I have updated the reference in my .mgcb file. I get the same error if I completely remove the reference or point it at a non-existant file. Building content works if I try referencing a version of the DLL from before I tried updating the .NET and Monogame versions.

Thinking that the problem might be with the references to non-Monogame libraries, I tried removing those references completely and replacing their use with hardcoded values. It did not help.

My project file looks like this and the code is as the linked repo, other than the uses of external libraries replaced with hardcoded values.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <ApplicationIcon />
    <OutputType>Library</OutputType>
    <StartupObject />
  </PropertyGroup>

  <ItemGroup>
		<PackageReference Include="MonoGame.Framework.Content.Pipeline" Version="3.8.0.1641" >
			<PrivateAssets>All</PrivateAssets>
		</PackageReference>
		<PackageReference Include="MonoGame.Framework.WindowsDX" Version="3.8.0.1641" >
			<PrivateAssets>All</PrivateAssets>
		</PackageReference>
  </ItemGroup>

</Project>

I tried googling the error and it doesn’t seem to have one specific cause and nothing I found really helped.

I noticed that the Monogame Pipeline Extension template targets netstandard2.0 and uses DesktopGL. I tried making these changes to my project, but it is still the same situation: The project builds with no errors, I update the reference path in the mgcb file and building content fails with error: Failed to create importer 'FieldFontImporter'.

UPDATE:
I discovered the cause of my this error. For some reason I was running an old version of the MGCB-Editor. I ran a dotnet tool update -g dotnet-mgcb-editor and I am now getting far more descriptive errors that I actually have a chance of solving.

I had this problem, too. The solution builds successfully in VS2019 but in VS2022 I get an error that the pipeline importer could not be created. I get this for all 3 of my custom pipeline importers. I confirmed this was happening on two different machines from a clean clone of my repo on GitHub. I tried updating the MGCB editor using your command line but that didn’t quite fix it. I had a few other things going on.

I had previously checked all the versions of the the frameworks installed, the targets of the projects and the NuGet package versions for MonoGame.

I found that the version of the MGCB editor that was coming up when I double-click the Content.mgcb file in Visual Studio was still an old 3.7 version, but the install command I used indicated that the latest 3.8 was installed. I fought and tinkered and figured out that there I had an old “MonoGame SDK” MSI package installed on these machines. I fixed it like this:

  • Uninstall MonoGame SDK from Windows’ “Add or Remove Programs” console.
  • Uninstall previous versions of MGCB which were installed through DotNet Tool commands (needed admin window for this).
  • Reinstalled and registered the MGCB Editor using the instructions on the MonoGame getting started page (even though these instructions are otherwise entirely useless or VS2022):
dotnet tool install --global dotnet-mgcb-editor
mgcb-editor --register
  • In CMD, type “where mgcb-editor.exe” to get the path to the editor.

  • In VS2022, right-click the Content.mgcb file and select “Open with…”, ADD a new entry, then point to the mgcb-editor path. Mark it as default. Double-click it, double-click it again.

  • Clean the solution, clean the MGCB project, then rebuild in the MGCB editor and the MGCB builds again. Now rebuild the VS solution and all is working.