This post is going to be longer than it needs to be. If you want to skip the backstory, just jump down to the section labeled How To Build XNA Games With Regular Visual Studio.
I originally started college as an Electrical Engineering major. That didn’t happen because I had affection for EE, I just happened to be good at understanding that sort of stuff and I figured the degree would get me a good paying job.
Then my mom bought a 486 DX2/66 and installed X-Wing from LucasArts. I was enthralled by the game and what computers were becoming capable of doing. About a year later I had to take an intro to programming class as part of my base curriculum as an Electrical Engineering major, and I was hooked. I instantly “got” programming. While people in my class floundered to understand the concept of a fixed array I was trying to figure out how to make Tie Fighters appear on my screen and blow up. I switched my major immediately to Computer Science.
A couple years later I tried to recreate the isometric engine from Diablo with (at the time) the latest version of DirectX (6). I was mostly interested in learning the API and graphical programming, but building that engine also taught me a lot about isometric games, 2D sprites, drawing algorithms, optimization and things like the “A-Star” algorithm (which I used for pathfinding so my little barbarian could walk around the screen).
I desperately wanted to be a game programmer. But life happens, and we make choices based on things that are really important to us. I knew what it would take to be a game developer; I’d have to move to a bigger city, my wife would have to leave her family and the job she liked, and I’d have to start at the bottom and work my way to the top. I wasn’t certain my marriage would survive such a thing; my wife is very attached to her family and our living location. With everything else that goes on in life it just wasn’t the kind of decision I could make. And so my career as a game developer died quickly and with little fanfair.
XNA Appears….
A week ago I learned that Microsoft has released a new framework called XNA. It’s designed to make developing video games for the PC and XBox 360 easier, especially for “hobbiest” developers. I’ve spent the past week examining XNA and working through some very good tutorials on the internet. XNA is a neat thing. It has completely renewed my interest in game programming.
There’s just one problem: Currently, the XNA Game Studio Express only works with Microsoft’s Visual Studio Express. You cannot write XNA Games on Visual Studio Standard, Pro or Team System. Joe Nalewabau of the XNA team explains the reasons for this decision.
This bothered me on a few levels.
My biggest gripe is that you can’t install a lot of 3rd party tools with Visual Studio Express, like ReSharper. I can’t imagine any professional developer today who wouldn’t have a tool like ReSharper plugged into their IDE. I was blown away when I read Dave Weller’s blog, the Game Developer Community Manager for Microsoft, and found out he only has Visual Studio Express installed on his machine.
I’ve had ReSharper installed for several months now at work, and like the wheel, television and the internet, I simply can’t live without it. Writing code without ReSharper is like trying to watch TV without a remote control, or trying to drive a vehicle without power steering, or trying to plan a cross-country trip withoutYahoo Maps. Sure, you can do all of those things given enough time, patience and Advil, but why?
The other major gripe I had was that I didn’t know this before I went out and spent $250 on Visual Studio Standard edition. As soon as I found out Visual Studio Express wouldn’t handle ReSharper I had to go get a real IDE. It arrived today in a nice Amazon.com box (side note: can Christmas compete anymore? I get more thrill from the Amazon.com boxes that arrive at my house than I do from Rudolph wrapping…) But it wouldn’t open or compile my XNA game.
But that doesn’t mean you can’t make it work.
How To Build XNA Games With Regular Visual Studio

The culprit here is the .XNB file. For every piece of “content” you need to load in your game, you need a corresponding .XNB file. When you compile a XNA game with Visual Studio Express, the .XNB file is created. Without it your game will throw an exception when you try and run it. Compiling with any other version of Visual Studio won’t do the trick, so we have to generate those files in another way.
First thing you have to do is install Visual Studio Express. Yes, you still have to install it on your machine, mostly because XNA utilizes some aspect of the .NET Framework that deploys with the Express edition of VS. But that doesn’t mean you have to be handicapped by that IDE.
Next thing you need to do is download the XNA ContentBuilder, a project on CodePlex. It comes in source or msi installer versions. The XNA Content Builder is what we’ll use to make our .XNB files.
Go ahead and create a Windows project in Visual Studio Standard, Pro, or whatever version you enjoy. Reference the XNA libraries in your project (Microsoft.Xna.Framework & Microsoft.Xna.Framework.Game). Write your XNA game code. Riemer’s XNA Tutorials are a good place to start.
After you’ve added the necessary content files to your game project, open the XNA ContentBuilder application and set the Intermediate, Output and Root directories to point to the correct directories of your game build (hint: the Root and Output directories should probably point to your bin/Debug directory). Then use the “Add” button to add the content files to the XNA ContentBuilder project. Hit the “Build” icon on the toolbar and the XNA ContentBuilder application will build a .XNB file for each content file added.
Bingo – you’re good to go.
Go back to Visual Studio Excellent Edition (whichever version you’re using) and build/run your game. It should work.
The whole process is painless and will only take a few minutes. If you’re like me and can’t stand the thought of having to code with an inferior IDE like Visual Studio Express, have no fear. You can still write XNA code with your powerful Godmode IDE thanks to the nice folks who wrote the XNA ContentBuilder project on Codeplex.
Happy game building!
Games :: Five Minutes To Building XNA Games (Without Visual Studio Express) says:
[...] Original post by Chris Holmes Online [...]
February 26, 2007, 10:30 pm