[SOLVED] Cannot load content from Shared Project


So I’ve been tinkering around with Monogame using Xamarin Studio and I wanted to try my hand at a cross platform project so I created a shared project and referenced it to a desktop project, the issue now is that I’m trying to load a 3D model, “Queen.fbx” that I exported from blender, I didn’t expect it to work on my first try but the problem is that I, for the life of me, can’t seem to load it. The following is a screenshot of what it all looks like.



[EDIT] Its a strange thing, the content folder shows up empty. It would be really inconvenient if we had to somehow copy the content browser to each version. Maybe we need some kind of shared content. A work around could be to make a bat file that copies the content to each project (Overwriting Content.mgcb in each project), which would take a while on large scale.


For people in the future who suffer the same fate.

So what I had to do was really quite simple. I started a new content library solution which I had named “core” with two other platform projects called “android” and “desktop”. To get a shared content working, all you need to do is, in the platform project folder, open the .csprog file in a text editor and change the line:

<MonoGameContentReference Include="Content\Content.mgcb" />
<MonoGameContentReference Include="[Main shared project directory]\Content\Content.mgcb" />

A small hint: in the directory you can use "..\" which actually navigates to the parent folder, and then you can enter into your main project. so my directory was ..\core\Content\Content.mgcb

For anyone else doing the same, I have a work around, ensure that your project folder is closed and copy the content folder individually to the projects, but assuming you’re as lazy as I am, you’d employ a bat file, an example is as following where I delete the old content folder and copy the new content folder.


del “Desktop\Content” /F /Q
del “Android\Content” /F /Q

XCOPY “Chaos\Content” “Desktop\Content” /Y /E && ECHO D
XCOPY “Chaos\Content” “Android\Content” /Y /E && ECHO D`

This is not being lazy, but it is an improvement of dev/test time by being clever
I prefer seeing it like that, this is more positive :slight_smile:

If you set the build action of the .mgcb in the shared project to MonoGameContentBuilder it will automatically copy the .xnb files to your bin folder. I find this setup with a shared project the easiest way to do cross-platform game dev with MG. You’ll need to manually edit the .shproj file to include the build action from the .targets file it’s defined in (check the .csproj from the templates to see how it’s done) and set the build action of the .mgcb file.

1 Like

Thanks I figured it out eventually.

1 Like