Good morning! I have a Build DAG that looks kinda like the diagram below (sorry for my crude MSPaint Drawing).
My setup
I have a platform-independent Engine.csproj and Game.csproj where most of the core code lives. The leaf nodes (the things I actually build) are GameAndroid and GameDesktopGL which are platform specific obviously.
Since Engine.csproj is totally platform agnostic, I need a really thin layer that handles some Desktop specific stuff when I build desktop (stuff like GameWindow.TextInput
that only exists on DesktopGL). To accomplish this I created a NetStandard Library that depends on MonoGame.Framework.DesktopGL (EngineDesktopGL.csproj). So it knows about DesktopGL functionality despite being a NetStandard library. It might be hard to see in the diagram but this means that EngineDesktopGL.csproj has a blue and an orange box around it.
I want to have a similar middle-layer for Android-specific stuff. But this isn’t as simple as swapping DesktopGL for MonoGame.Framework.Android. I also need real “Android” platform stuff (particularly stuff from Mono.Android).
My first solution (worked but I don’t like it)
So I have a thing that… works. But it’s super hacky and gross and I was hoping for something better. What I could do is rebuild EngineAndroid.csproj as a MonoGame Android Template (so rather than being a NetStandard library it’s a whole-ass game that I just never build on its own). This appears to work but it does mean that EngineAndroid is way bigger and has more dependencies than it needs. It also means that EngineAndroid can be run on its own which is undesirable.
My second solution (didn’t work)
It feels like I should be able to copy the <Reference Include="Mono.Android" />
line from GameAndroid.csproj and use it in EngineAndroid.csproj but that doesn’t seem to work. It seems Mono.Android doesn’t work like a normal package.
This seems like it should be an uncomplicated problem. But it’s feeling complicated. What am I missing?