It’s been more than two months now and the issue keep showing up randomly. I’ve yet to find a reliable workaround, as even the prebuild events above don’t always work, as well as deleting the obj and bin folders. This is driving me insane.
EDIT two weeks later
So for anyone running into this issue, I’m afraid to report that I still haven’t find a proper fix ; I would still get a Content file was not found for no reason, that would or wouldn’t stay after a full clean + rebuild. But I did find something that can help continue to work and test without waiting too much.
I took the time to set up a monogame shared project, that allowed me to run the same code and use the same assets wheter I’m compiling on android or windows. I’m basically only testing the game on windows now, and only when I have to publish/do a specific test on android do I fight with visual studio/monogame and this cursed bug. I had to try several tutorials to set up the shared project. Here’s one that worked for me: https://manbeardgames.com/tutorials/multiplatform-game-development-with-monogame/#method-3-the-monogame-shared-project-approach
I follow the second method proposed by the article and it worked.
Making my android game playable on windows required a few tricks, like emulating a touch collection with a mouse position and state. Here’s roughly how I did it (ms_tc is my emulated touch collection, ms my MouseState):
if (ms.LeftButton == ButtonState.Pressed && previous_ms.LeftButton == ButtonState.Released)
{
ms_tc = new TouchCollection(new[] { new TouchLocation(0, TouchLocationState.Pressed, Mouse.GetState().Position.ToVector2()) });
}
else if (ms.LeftButton == ButtonState.Released && previous_ms.LeftButton == ButtonState.Pressed)
{
ms_tc = new TouchCollection(new[] { new TouchLocation(0, TouchLocationState.Released, Mouse.GetState().Position.ToVector2()) });
}
else ms_tc = new TouchCollection(new[] { new TouchLocation(0, TouchLocationState.Moved, Mouse.GetState().Position.ToVector2()) });
I also binded several actions to key press.
I know this is more of a way to escape the problem rather than to solve it, but that’s what allow me to continue the developpement. The additionnal bonus is that you now have a port of your android game on desktop.