Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm quite new to Monogame and PCL, but I hope someone can help me with my question.

I have a Monogame/Android project with references a PCL which targets .NET 4.5, iOS and Android. The PCL has content files suchs as SpriteFont and Texture2D. They are set to "Content", "Always copy" and are .xnb files. The problem is when I start my Android game I get a "asset not found" exception for the content in the PCL. When I launch my Windows game it works all fine.

To begin with, can I have content files in a PCL and is that good practice?

share|improve this question
add comment

1 Answer 1

That's a good question. Unfortunately, I haven't got an ideal solution, but I do have a similar setup to you with a PCL and an Android project. As you can see, I have the content in the PCL set to "Content", "Copy if newer".

In the Android project I have added the same files under the Asset/Content folder as links to the original files and set their properties to "AndroidAsset". It works just fine, but it does mean I have to keep add content to both projects which is slightly annoying.

Portable Content Example

I'd be interested to know if a better solution to this problem comes up.

share|improve this answer
    
Thanks for your reply! But as you said, its more like a counterproductive solution. –  Nyanko Feb 13 at 11:25
    
It is, but it's better than nothing. What I normally do is make the game as a Windows GL project then every so often I do a quick port to Android by relinking all the Content. It may not be perfect but it's only a 5 minute job. You still get most of the benefits of a PCL and it sure beats code sharing. –  craftworkgames Feb 13 at 22:10
    
Did anything change since then? –  Den Apr 14 at 20:10
    
Things are changing slowly. If you are interested in portable MonoGame follow this guys blog.. darkgenesis.zenithmoon.com/monogame-3-2-nuget-packages-are-go –  craftworkgames Apr 15 at 3:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.