How to use / organize content from multiple projects?

I was wondering how to organize my projects and content. So far my plan is to put all inside one solution. I have a game library with classes I want to use in multiple projects. Then I have a project which is basically a test game using stuff from the game library. The test game has a lot of content. Now I want to start another project. This project will need content from both, the test game project and its own content project.

My main purpose is, to not duplicate content, because then maybe things get out of sync. Whats the best solution for this?

Experimenting with the pipeline tool with “add a link to the file”. I think this might be the solution for my problem, but I have trouble loading the linked file. It must be an issue with the wrong path, I guess. How do I find out the right path for a linked file?

I found out, the content of linked files gets build, but not to the same directory as the projects content. So the problem with that is, that the content of the linked files will not automatically be copied to the folder, where the project would be able to load the content. (It all works fine, if I copy the generated content of the linked files to the same location, where the final output for the projects content resides.

So my question now is only, how to get the pipeline tool output the content of files added as links to the same directory as the projects content?

You can have multiple mgcb files to keep things organized. Then add them as a link to the project you want them in. There are some issues with that but a PR that fixes it is up. It just needs testing, so maye you can try it out :slight_smile: it’s https://github.com/MonoGame/MonoGame/pull/4997

Is it related to https://github.com/MonoGame/MonoGame/issues/5109 too ?

Yeah, there are some issues with file linking too…

This works. With the linked MGCB file in the new project. So I renamed both MGCB files. Then I added the MGCB file as link in visual studio to the same directory, where the projects MGCB file is. After compiling the project, I get the projects content to the “…bin\Windows\x86\Debug\Content” folder. And I get the content from the other project, which is copied to “…bin\Windows\x86\Debug\Content<NameOfOtherProject>\Content”.

For the other project, the *.mgcontent files get also copied? Its no problem, but it would be nicer with only the '.xnb files.

What other project and what are *.mgcontent files? You mean the source assets? Did you maybe add them to your project so they’re copied over to your bin folder too?

Oh yes… I forgot that yesterday, while testing around, I copied the content of the other project into “Content\bin\Windows” folder of my project… From there it got copied automatically to “bin\Windows\x86\Debug\Content”. So it does not work with a linked MGCB file then… :confused:

Did you check out the branch from the PR that I linked? It won’t work with 3.5 or the develop branch

I checked it out but I dont understand the whole process of the development. I thought it would work already. So then I will just copy it manually for now. Thank You

Have you ever built MonoGame from source? If you have this isn’t too hard.

Another option is to get the binaries from the build server and run the installer or just reference the dll’s from there. If you’re interested I can post the link when I get to my laptop. I’m on mobile right now

No, I have not built MG from source… I’m interested, but at the moment in my little free time I want to focus on my little Framework I’m working on.