13
\$\begingroup\$

I understand that an XNA project for XBox 360 will use a specialized version of the .NET Compact Framework. But let's say I want to release for both XBox 360 and Windows.

Will the XBox version (using compact framework) still work if distributed for Windows, or would I need to rebuild against the regular framework (or the non-Xbox CF) in order to distribute?

\$\endgroup\$

2 Answers 2

15
\$\begingroup\$

Yes, different platforms run different .net runtimes.

The way this works in xna 3/3.1/4 is you create your game project for a single platform (say, create a new Windows Xna game project in visual studio). In visual studios 'solution explorer', right click the project and then chooses 'create copy of project for X', where x is the platform you want the new project to target. Thats pretty much all there is to it. create copy of project

These two projects are kept in synch, anything you add to one will show up in the other. Use #if WINDOWS or #if XBOX or #if WINDOWS_PHONE blocks to add code that is specific to a single platform.

\$\endgroup\$
2
  • \$\begingroup\$ Ahh, that's why the sample projects have "Copy of X" in them. I assumed they were just manual copies, I didn't realize XNA+VS automated that. Very useful! And the picture demonstrates where the option is very nicely. Sounds like it would be best to start with an XBox project then and do a Windows copy if I'm planning for release on both from the start. \$\endgroup\$ Commented Oct 22, 2010 at 18:06
  • \$\begingroup\$ Personaly id always start from a windows project, its easier to debug on windows and you get tools like perf hud and pix. It dosnt matter which way round you do it, but doing that way round kind of solidifies the idea of c main dev platform, but test early and often on 360. \$\endgroup\$
    – Cubed2D
    Commented Oct 22, 2010 at 18:42
3
\$\begingroup\$

You need to rebuild for Windows. There is a tool to automate the process of converting the visual studio projects. Since you started on the 360 and the compact framework you should be largely okay. Going the other way you can run into issues where you use .Net framework features that aren't supported by the compact framework.

The docs contain a section on differences between the two (for example, you can't set the processor affinity on Windows). If you're actually releasing your game on the PC you might run into compatibility issues. Eg, your render buffer format might not be supported, or your shaders might not compile. This is the curse of PC development though and not specific to XNA.

\$\endgroup\$
2
  • \$\begingroup\$ Nice to be aware that I might run into shader or buffer problems on PC as well. I assumed that XNA was hiding most of those little details but I guess some still slip through. \$\endgroup\$ Commented Oct 22, 2010 at 18:20
  • \$\begingroup\$ Yes, PC hardware is wildly varied. But I have found that the xbox quirks to be harder to account for than features of modern mainstream graphic hardware. That a loose standard, i know :) \$\endgroup\$ Commented Aug 22, 2012 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .