Developing XNA Apps in Visual Studio 2012
While I was searching for a way to make it real, I found a not-so-well adviced technique by not using XNA GS and its easy implementations.
Have been trying to find a way since there is no official release for XNA GS in Visual Studio 2012 even its Release Candidate.
But i've found something not a good idea but works anyway.
If we dont want to use XNA's Content Pipeline then what worse things can come out of it:
Well, much more lines of code!
Now, create a new Class Library Project in .NET Framework 4.5(later we'll transform it to Windows Application)
Add reference from a .NET Framework 4.5 project as its displayed there you cant see XNA .dlls as a reference but as an extension!
So we've added the .NET 4.0 extensions for XNA Framework
Now its better we write a Program.cs file and set it as a Startup Project
static class Program
static void Main(string args)
using (Game1 game = new Game1())
Later we set it as Startup Object from Project-> [YourProjectName]Properties
Now lets create a new Game class and add codes for it:
public class Game1 : Microsoft.Xna.Framework.Game
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
protected override void Initialize()
protected override void LoadContent()
spriteBatch = new SpriteBatch(GraphicsDevice);
protected override void UnloadContent()
protected override void Update(GameTime gameTime)
protected override void Draw(GameTime gameTime)
Here we are!
Now lets run it if it will run or not:
OK. That was a nice punch to the face. I admit!
Why this problem occurs because of lack of 64-bit support for previous .NET framework references which we call extensions.
Now head over here:
and change as it seems:
After you change it to x86 it must have worked nicely
An empty screen drawn with CornFlowerBlue Color works as it should be while working with XNA GS.
Now why dont we just fill it?
Lets add a sample sprite it render it inside XNA project:
Lets add a picture inside your project.i added a performer png file,you can your own.
Add these variables for x,y corrdinates,width and height of the sprite and the object that we will create sprite from "Texture2D"
Inside LoadContent add these codes:
pic_texture = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(@"performer.png"));
Here we set up our texture2d object to load an external image file through a path - which is in the same place as code files -
Then in Draw add these codes:
spriteBatch.Draw(pic_texture, new Rectangle(x, y, width, height), Color.White);
Here we render our sprite with given texture file,x&y coordinates,width and height of the sprite shall be.
Lets run it!
And display our sprite:
Even though XNA GS wasnt installed,you've succeeded on developing for XNA platform(Windows only) in Visual Studio 2012.
I do hope that it works in Windows 8 as well even though i was doing this work in Windows 7 system.
Hope this article helps you on your studies
Feel free to drop a comment if you disagree with me the way I suggest here.
Have a nice day!
Great Article.. i found a decent work around also..
by installing a VS2010 Isolated Shell i was able to install XNA Game Studio.
I found that installing SQL Management Studio 2012 installed the Isolated Shell for me, since it was a tool i use often i didn't have to download the Isolated shell.
From here i copied the XNA Game Studio Folder from
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft to
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\MicrosoftC:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft
then changing the line for Visual Studio Version in file extension.vsixmanifest from 10 to 11. i was able to get it work fine in VS2012
you may have to run devenv.exe with a /setup to have VS reconigize the changes.
A great post, just mentioned it in my Recent Windows 8 and XNA article (http://bit.ly/PxSlHc). Previously I had thought WinForms was the only route but this is much cleaner.
I've tested it in the RTM and it also now works in all configuration options as well.
I've also managed to work out the Content builder part of the equation as well in that article.