Visual Studios Project Structure?

So I’ve started a new monoGame project and everything is going well. But one thing that I am wondering is if there is a way to set up a library within a shared class. I’ve been looking around but I haven’t found anything that is very elegant. At the moment my project setup looks like this:

Both iOS and Android projects make use of a shared project. The shared project is going to have a ‘gameServer’ which will also be exported as a dll and run on the server for server-side validations. But, shared projects cannot reference dependencies and cannot reference files as a link. So in order to get the ‘gameServer’ into the frontend, I have just created the ‘gameServer’ within a folder in the shared project. I have then added these files which makeup the ‘gameServer’ to a separate .NET class library project in order to export it as a dll. This works for now but this is pretty terrible for github integrations and the general project structure.

Has anyone had a similar project or can advise on the best way to structure this type of projects is?

Just reference the Gameserver project in the Android and iOS project. The projects that inherit the shared projects are responsible for resolving dependencies, this includes stuff like nuget packages and assemblies.

Your title is misleading btw, this has nothing to do wtih Visual Studio

I’m not sure that’s what I need. If I just reference the Gameserver in the platform-specific projects it still doesn’t let me reference the Gameserver in the shared project. I’m doing all of my rendering within the Shared content and the renderer needs access to the Gameserver to know the game state and where things in order to draw them.

Maybe I’ve structured my VS project wrong? Should rendering not be shared?

Well that’s the way you’re suppose to do it =/ Can you share some screenshots of your VS with your project open so it’s easier to see exactly what’s going on? If it’s not too confidential you could also share the project which would make it the easiest to help you.

Here’s an image of my current project layout. The “Core” is the game server which is just referencing the files in the shared project as a link. Shared project is then imported to iOS and android.

I don’t have time to look at it exactly now, but could you maybe look at this project and see how it’s done here?

Move the GameServer code to the Core project and reference it from your platform projects. That’s how you’re supposed to do it, what error messages do you get if you try?

Ah! I found out what I was doing wrong. Before I had created a .NET Framework class library but in order to link them I needed to use a .NET Standard class library. Everything is working as expected now. Thanks for the help!

1 Like