MonoGameContentReference build action for shared project?

Like @pauliharman, I am trying to get the Monogame Content Builder working on a Universal App using the method described by @SimonDarksideJ in his blog here: Content project filename not passed to MGCB.exe

I’ve got a little further than Paul in that I have the .mgcb file included in my projects and working - however, the important word here is “projects”, with an “s”: I can’t seem to hack the .shproj file of the shared project to add the MonoGameContentReference Build Action.

If I include the .mgcb in the platform-specific projects and add a MonogamePlatform node to each .csproj file (with values of WindowsStoreApp and WindowsPhone8 for Windows and Windows Phone respectively), the projects build and execute just fine! Similarly, if I add XNBs from a Pipeline editor project build directly into the shared project, this works too.

I’m using VS2013 Community (thanks @filcon for the heads-up!) and a 2-day old copy of the development branch.

Anyone know if it’s possible to set up the Build Action on the shared project?

Cheers!

Hi Ben
If you followed all the instructions.
1: Create a new .mgcb file in your project
2: Edit mgcb file in the content builder tool to add assets or import your pre-existing .contentproject
3: Edit .csproj and add the MonoGame platform entry
4: Edit the .csproj and add the import section for the content processor

You should then be able to set the build action for the .mgcb file to MonoGameContentReference

Which will then build your content project assets when you build the project.

You can check the MonoGame samples repo for an example of this, or check out the mva session that Andy and tom did recently which also showed a universal project setup.

Hope this helps

Oh and on a side note Ben.
The Content project is platform specific. SO you need to edit the Windows 8.1 and Windows phone projects independently.
The content project does not get added to the shared projetc :smiley:

Thanks Simon. Can the Pipeline tool build be called from the command line instead of running the application and clicking the “build” option? I’m wondering if it would be possible to create a script to invoke the content build, then copy the resultant .XNBs into my shared project as part of the solution build…

Of course.
When you build the project, the mgcb.exe command that was run is displayed in the output window.
If you wish you can automate automate building by copying that and using it un a script instead :sunglasses:

I still can’t get this working (Content project filename not passed to MGCB.exe) with the .mgcb files in the Visual Studio project. :frowning: