2

I have an XNA project that I'm trying to port over to Android using MonoGame, but I get the following errors:

When I add a project reference my XNA game I get, "The Target Framework version for the project is higher than the current project Target Framework version. Would you like to add this reference to your project anyway?"

So I say yes, and then it gets a warning flag in Visual Studio's Solution Explorer. When I build, I get the error:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'XXXXXXXXX.csproj'." . Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

So I'm thinking that the reference to my XNA game is the problem. It's Target Framework is .NET Framework 4 and my Android project target is Android 2.2.

I've read[1] that Android doesn't have .NET 4, so I'm thinking that's the problem but I've attempted to make a class library to reference, but I'm not sure how that would work exactly. I've added a reference to my XNA game in my class library and added a reference to my class library from my MonoDroid project, but now I can't create an instance of my XNA game (i.e. when I try to do Game1.Activity = this; it doesn't recognize Game1).

Am I missing something obvious? This has been bugging me for several hours!

EDIT: To clarify, I have 3 + 2 projects: an XNAGame, MonoDroidApp (using MonoGame Framework), and MonoDroidLib (Mono for Android Library), plus Lidgren.Network.Android and MonoGameFramework.Android.

If I understood correctly, I was supposed to basically trick the compiler by making a reference in MonoDroidLib to XNAGame and making a reference from MonoDroidApp to MonoDroidLib. I thought if it worked, I would indirectly reference XNAGame in MonoDroidApp and be able to make an instance of XNAGame, it didn't work.

1: Prexisiting dlls (.NET 4 framework) issue with mono for android

Community
  • 1
  • 1
  • Can you please specify the type of projects you have added? What is the project reference pointing to? A Mono for Android application? A Mono for Android class library? You can't add a reference to a normal .NET Library in a Mono for Android project. – Alex Wiese Nov 16 '12 at 03:51
  • There is a similar question here: http://stackoverflow.com/questions/10551652/prexisiting-dlls-net-4-framework-issue-with-mono-for-android – craftworkgames Nov 16 '12 at 04:12
  • My projects are my XNA project (which I think uses .NET) which I am trying to use in a Mono for Android application using MonoGame and I made a Mono for Android class library after reading from the url I gave. I'll call them XNAGame, MonoDroidApp, and MonoDroidlib. If I understood correctly, I was supposed to basically trick the compiler by making a reference in MonoDroidLib to XNAGame and making a reference from MonoDroidApp to MonoDroidLib. I thought if it worked, I would indirectly reference XNAGame in MonoDroidApp and be able to make an Game1(), but it didn't work. – Charles Hans Huang Nov 16 '12 at 04:14
  • From my understanding you need to create an android class library and add your XNA source files to it so it compiles against the Mono for Android framework instead of the vanilla .NET 4 framework. Have you tried this? – Alex Wiese Nov 16 '12 at 04:46
  • OK, I've tried it again using this tutorial http://www.jmawebtechnologies.com/company-blog/april-2012/porting-an-xna-windows-phone-game-to-android and I've added links to the XNA project files in the MonoDroidApp project and put the MonoDroidApp in the XNAGame namespace and it built! Now the problem is getting it to run in the OpenGL ES 2.0 frame buffer... – Charles Hans Huang Nov 16 '12 at 19:49

1 Answers1

0

The Monogame doesn't use XNA assemblies after project being built. It means your final project cannot access any XNA assemblies you have referenced. That's why monogame project doesn't have XNA content project it has assets folder instead.

Wallstrider
  • 856
  • 1
  • 7
  • 22