MGCB file "as a link"

Hi!

I’m trying to start moving towards MGCB integration and I’m having a problem with a linked MGCB file. My development directory struct is as following:

+project
---- assets
---- code
---- solutions

Obviously the solution with the project which has the MGCB lies inside solutions. In order to access the assets, I have to point to …/…/…/assets.

Unfortunately MGCB does not handle very well the “…”, and I end up with my content output outside the solution file.

My idea is putting the MGCB file inside the assets directory, and this way I can conserve the asset structure.

My problem however is that adding a MGCB “as a link” in visual studio, leads me to the following error:

Unhandled Exception: System.ArgumentException: Empty path name is not legal.

looking at the commandline executed, shows /@:"" (response file is empty)

Is this a bug or I’m doing something wrong?

Thanks!

Hi KakCAT. I had the same issue with directory resolution and the … operator.

To answer your question – here is how we leverage the directory structure.

Toolbox
Toolbox\Toolbox.sln
ToolboxProtoContent(content lives here in subfolders etc)
ToolboxProtoContent\ToolboxProtoContent.mgcb
Toolbox\Toolbox(MonoGame Project lives here)
Toolbox\Toolbox\Toolbox.csproj

Inside the Toolbox.csproj file
... <ItemGroup> <MonoGameContentReference Include="..\ToolboxProtoContent\ToolboxProtoContent.mgcb <Link>Content\ToolboxProtoContent.mgcb</Link> </MonoGameContentReference> </ItemGroup> ...

Make sure you have the platform type defined.
<MonoGamePlatform>Windows</MonoGamePlatform> in your property group at the top of the project file.

You should also have a MSBuild targets reference towards the bottom for the content builder.
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />

Your .mgcb file should handle the output directory for your .xnb files.

Hope this helps.

This is a planned feature. see:

thanks a lot, after some tweaking of the csproj file it’s working as I need :slight_smile: Good to know a non hacky way is also in the works :slight_smile: