[SOLVED] Can't compile processor .dll's with MGCB.exe

Hi. I’m trying to get SkinnedModelPipeline working with my game. The problem is, after copying the .dll and the .fbx to the directory of MGCB.exe and doing this:

_MGCB /processor:SkinnedModelPipeline.dll /build:mod_lizard_skinned.f_bx

I get this output:

Failed to create processor ‘SkinnedModelPipeline.dll’.

I know my .fbx model works (I’ve used it with my game before, just without animations), and I copied the .dll from Microsofts example without changing it, so I don’t know what the problem is anymore… :disappointed:

Any help would be greatly appreciated. Through my searches I’ve found several other people who could really benefit from a tutorial on this (which I hope to create once I get things working).

It may be also related to Mesh effect field and the problem of setting an effect at build time with parameters. I’m looking in the pipeline and trying to understand it, but it is a pain to debug

1 Like

Do you mean like how the Process(input, context) function has parameters?
There is an option in the MGCB console to set parameters, but I’ve no idea what to pass into them. My apologies for all the questions, I just really don’t know the slightest thing about how processors work (I didn’t think I’d need to know for Monogame). Thank you so much for all your help thus far though!

The easiest way to see what a proper MGCB file looks like is to create a small content project in the Pipeline tool. Otherwise, run MGCB.exe /? to see a list of parameters it takes.

As for your specific issue, the ‘processor’ parameter specifies the name of the class to instantiate to process the imported asset. You tell MGCB to load a custom DLL with a separate parameter (‘reference’ I think). Run MGCB.exe /? to be sure.

Thanks KonajuGames, that seemed to be what it wanted, but there seems to be more to it. This is what it returned after I gave this input (file URLs shortened):

MGCB /processor:SkinnedModelPipeline /build:mod_lizard_skinned.fbx/reference:SkinnedModelPipeline.dll


Build started 4/28/2016 8:11:49 PM

Assembly is either corrupt or built using a different target platform than this process. Reference another target architecture (x86, x64, AnyCPU, etc.) of this assembly. ‘C:/…/SkinnedModelPipeline.dll’: Could not load file or assembly ‘file:///C:…SkinnedModelPipeline.dll’ or one of its dependencies.

An attempt was made to load a program with an incorrect format. C:/…mod_lizard_skinned.fbx C:/…mod_lizard_skinned.fbx: error: Failed to create processor ‘SkinnedModelPipeline’

Build 0 succeeded, 1 failed.

Time elapsed 00:00:00.27.


Out of curiosity, I edited the SkinnedModelPipeline.cs to see if it’s show me anything by doing this:

I don’t know much (or pretty much anything) about processors, but I thought this would at least show me the string I wrote. I compiled it and copied the .dll to the same folder as MGCB, but it was the same result as above.

You can’t use the console to debug it.
Either you need to get the Monogame’s sources, set the “debug” to true in the pipeline tool and choose an instance of visualstudio to debug (and even like this i haven’t found how to debug the processor’s dll like this, it will only show what MGCB is doing)
or you make your processor write strings into a textfile :wink:

Make sure the SkinnedModelPipeline project is a class library that targets .NET Framework 4.5 and either AnyCPU or x64.

I could do the 4.5 thing easy,

but the second:


The options don’t seem to be there (and I’ve tried clicking <New…>). That, and the MGCB also complains about not finding the default importer :confused: I’m really sorry for all these questions, it’s embarrassing.

Selecting <New...> in that Platform dropdown should give you the option of adding a x64 platform.

And it looks like you’re still using the XNA csproj for the pipeline extension (by the presence of the Xbox 360 platform). If the x64 platform is not available to be added, it may be because of that. If so, create a new class library project.

Nope. The only option for “New platform” is “Windows Phone”.

That is because it is a XNA Content Pipeline Extension project, and XNA only supported x86, Xbox 360 and Windows Phone 7. Create a new C# class library project to replace the existing SkinnedModelPipeline project, and add the existing source files to it.

Ok, I’m back. I made a new processor project, and added my files to it like so:

I set the Framework to 4.5, the compile to x64, built the project, got the .dll, ran it through MGCB.exe and…

MGCB /processor:SkinnedModelProcessor /reference:MGSkinnedModelPipeline.dll /build:mod_lizard_skinned.fbx

Build started 4/29/2016 9:30:24 PM

Failed to load assembly 'C:/.../MGSkinnedModelPipeline.dll': Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
C:/.../mod_lizard_skinned.fbx C:/.../mod_lizard_skinned.fbx: error: Failed to create processor 'SkinnedModelProcessor'

Build 0 succeeded, 1 failed.

Visual Studio let me build the project just fine, and I added references as is in the image. I also tried throwing a new TypeLoadException() in the Process function, but that didn’t do anything.

Was there a full path to the DLL in that error message? Was it correct?

Yes (I just shortened it to be easier to read sorry). I tried deliberately passing a bad path and it gave a different error message.

It appears to be one of those errors where there could be one of several solutions.

1 Like

Aw man, I don’t understand a lick of this…

All I knew how to do was copy the XNA example. I tried the whole error catching thing suggested in the link, but nothing seems to output anything to the console whatsoever. I think I may be in over my head. I guess I’ll just hope MonoGame implements skinned meshes as a default thing. As it stands, I just don’t think I’m qualified to be doing this.

Thanks for all your help though, KonajuGames. Sorry about all this.

Are you using a reference to *.dll in your processor ? If yes, you must also copy it in the folder to allow mgcb to find the type

Yeah, I’ve copied every *.dll I could find into the directory:

I mean one you have added, like “skinningdata.dll” referencing the things passed to the mesh.tag field.
If you have a bad understanding of C# coding or visualstudio use at least, it will be difficult to port a code from a “technology” to another one (XNA > MG).