Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Talk:XNA Games On Windows Phone 8 with Monogame

From Wiki
Jump to: navigation, search


Hamishwillee - Review/feedback

Hi kariosgames

There are some minor grammatical errors, but this is pretty interesting. I'm sure that a lot of developers probably do want to extend their WP7 XNA apps with new features of WP8, and this is one way to do it.

In terms of "Room for improvement", I would love to see a basic game example provided (buildable, in a zip) which demonstrates the addition of a new WP8 feature to an XNA game. If not, maybe just the "basic template project" you created above, so that people can run it "out of the box".

Thank you for this contribution - I hope the judges also value it highly.



hamishwillee 07:37, 14 December 2012 (EET)

Hamishwillee - Subedited for wiki style

Just FYI, did a basic style edit. Still think your article would be improved with a buildable example showing the "key benefit" - using WP8 features in your XNA app.

hamishwillee 02:21, 19 December 2012 (EET)

Kariosgames - Thanx

Thank you so much for the comments and the edits. I could not decide which one to do, so I did both :) I have a final template ready to download and test as well as a simple game that is running in HD resolution in WP8, which is one of the most requested feature for Windows Phone games. I've added links for both at the end of the articles.

I hope this makes the article even more useful for the community.

kariosgames 03:25, 25 December 2012 (EET)

Panickev - Error

I downloaded the sample game en when I open it in Visual Studio 2012 and try to run it it says "The referenced project 'D:\Github\MonoGame\MonoGame.Framework\MonoGame.Framework.WindowsPhone.csproj' does not exist."

I tried solving this by copying the Monogame.Framwork Folder into the MonoGame folder. Then I reloaded the MonoGame.Framework.WindowsPhone project but the error keeps coming up. Do you have any idea of what I'm doing wrong?

Panickev 03:24, 28 January 2013 (EET)

Kariosgames - Hmm

It should work. All you need is to have the project loaded in the solution and referenced in your game's project. Alternatively, you could compile the MonoGame Windows Phone project and reference the library instead in your game.

kariosgames 17:36, 29 January 2013 (EET)

Panickev - Other Error :P

I tried referring to my game from the MonoGame Windows Phone Project but then it says that my game can't find the Microsoft.XNA.Framework and Microsoft.XNA.Framework.GameServices. I tried to add the reference from: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0\Microsoft.Xna.Framework.dll, but it still says It can't find it. Any Ideas?

Panickev 20:28, 31 January 2013 (EET)

Kariosgames - XNA

The point of using MonoGame is to use it instead of XNA, so the reference you used is wrong:) What you have to do is refer MonoGame from your game, not the other way around. The namespace will then be available (MonoGame uses the exact same namespace as XNA, with Microsoft's blessings) so your game project should be able to find it. Alternatively, you can compile MonoGame and then reference the resulting DLL from your game, so you don't have to include the whole MonoGame project in your solution. This is a simpler solution, but everytime there are fixes in MonoGame (and there are quite often) you will have to re-compile the MonoGame project.

kariosgames 21:24, 31 January 2013 (EET)

Panickev - XNA

Thank you for your help :) I created a new project (named Test) and folowed the steps one more time and now I'm at the point where the project launches with no errors. But when i try to use: int screenWidth = _graphics.GraphicsDevice.Viewport.Width; i get this error: An exception of type 'System.NullReferenceException' occurred in Test.DLL but was not handled in user code Is there still a refference that I'm missing?

I also have a problem with the content. I've added the folder Content (wich has a folder in it called tiles and that one has a file in it named 1.xnb) in the directory wich also has the Test.csproj file. Then i changed the Content tag in the Test.csproj file. But when i try to loadthe content with the code: Texture2D t = Content.Load<Texture2D>("tiles/1");

I get this error: An exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.DLL but was not handled in user code

Panickev 02:32, 1 February 2013 (EET)

Kariosgames - Content

For your error, I am guessing that the _graphics object has not be initialized at the point you are trying to get the graphicsdevice, thus the null exception. I would need to see more of your code to know what's wrong. What I can tell you is that the Viewport of the Graphics device has been implemented and works as expected in MonoGame normally (line 1451 on the current GraphicsDevice.cs file) Regarding your content issues, make sure you have done the following: -Content must be compiled through a "normal" XNA project beforehand, you can only use the resulting XNB file in your WP8 MonoGame project (I guess you've done that already). -Content must be in the Content directory which is added to your main project, not a separate content project as is normal for XNA solutions. -The build action for content must be sent to "Content" and not "Compile"

-The Copy to Output Directory must be set to "Copy if newer" or "Copy always"

kariosgames 16:06, 1 February 2013 (EET)

Cyber k9 -

Hi; first of all, thank you for the tutorial - I found the last build of MonoGame had many of the "minor issues" already taken care of, but this article was still a great help! :)

I've run into a problem, though, and was hoping you could provide some more guidance.

A sample XNA project I was working on in WP7 can catch the "Back" button with:

if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) {

  System.Diagnostics.Debug.WriteLine("Back pressed!");


My hope was I'd be able to do the same - ultimately catch the "Back" button to pause a game, return to the main screen, then exit... but right now, I always get "The name 'GamePad' does not exist in the current context". I can't seem to find any documentation on how to do the same in MonoGame on WP8.

(Similarly, information on handle touch events would be helpful - but I think I can do that with "TouchCollection"? - it's the Back-button handling I'm fighting with at the moment).

I'd appreciate the help!

Thanks. :)

cyber_k9 09:31, 3 February 2013 (EET)

Kariosgames - Gamepad

For these kind of issues we are using the git system and discussions. The particular problem you mention has not been pulled to the main repository yet, but has been solved here: (essentially Nezz created a gamepad class just to solve the back button compatibility situation). If you are in a hurry, you can get the file here: ( If not, you can wait until it gets pulled into the develop3d branch.

In general I suggest that you monitor these discussions ( and even participate to help solve these kind of issues for everyone.

kariosgames 14:12, 3 February 2013 (EET)

Cyber k9 -

Thanks kariosgames;

I was able to download the GamePad.cs file, put it in the right folder (and added it to the MonoGame.Framework.WindowsPhone project in my solution), but unfortunately I'm still getting that error. (in fact, I downloaded Nezz's whole branch and used that). It's odd. I tried a Rebuild of the MonoGame.Framework.WindowsPhone project, thinking maybe it needed that before the GamePad class would be available, but it throws errors (RoutedEventArgs could not be found" in "MediaPlayer.cs", for example).

If you have any further pointers on it, I'd appreciate it. However, I will search through the discussions on GitHub that you mentioned and may pose the question there shortly if I can't solve it. Thank you for pointing me in the right direction! In the meantime, there's certainly other stuff I can tackle on the game itself(!). :)

Thanks again.

cyber_k9 00:30, 4 February 2013 (EET)

Kariosgames - WP8 Working

Hey guys! Managed to get a WP8 only game on the Marketplace using MonoGame. I had to use this: which has everything working correctly, and the game I published is MonsterUp Memory with HD graphics (available for free here: I guess at some point these changes will be merged in the original MonoGame github repository as well.

I hope this helps!

kariosgames 17:39, 9 May 2013 (EEST)

Hamishwillee - Kariosgames - great job!

Thanks for sharing your success.

hamishwillee 08:51, 14 May 2013 (EEST)