Question about shared code folders in different projects

Hey everyone,

I’ve got a quick question about using a folder layout for shared code across projects. Right now I have the following project layout:

This is a platform-specific project which, as you can see, links to a big bunch of core code, all of which sits in a separate folder and separate namespace, and a content project which, again, has its own folder. I arranged my project based on this blog post.

The annoying thing is that all of the folders containing the linked code (here called Environment, Quadtree, Utility, etc…) have to be re-created in my platform-specific project folder. This means that every platform project I create will have a tree of empty folders, identical to the core code folder structure, which is a bit of a pain.

Is there a way to see the correct folder structure for all the linked code without creating a load of empty folders? Can I just link to the folder structure of my core code?

Thanks!

You could put it all in another, common folder so you can link them all at once. I’m not sure what else you can do with linked code, which is absolutely one way to solve multi-platform issues.

An alternative way would be to build everything as a DLL. I build mine as portable, which allows me to reference them for any platform. The only folder I link to is my content folder, for each platform’s executable. Portable libraries have been deprecated by Microsoft though. You can still use them, but I think the new way is Core, or something like that? I haven’t explored using them yet.

Use shared projects instead, then you don’t have to do so much linking

Thanks for the replies! I went with an MG shared project and it worked perfectly. Only annoying thing is that I can’t do it with the content, as MonoGameContentReference isn’t available as a build action even when I specifically create a Monogame Shared Project template :thinking:

I created a project here: https://github.com/Apostolique/Apos.Framework

You can look at how it’s setup with the shared projects. I can answer questions if you have any.