There really isn't a better solution available today. In order to compile a single project for both Xbox 360 and Windows, it means the C# project has to have different references for each configuration. The VS IDE doesn't handle changing references very well, even though msbuild can handle it.
Although our current design allows simple cases to work, it doesn't take much effort to get "outside the lines," where features in the IDE break because the references have changed and the IDE doesn't expect it. Enough stuff can go wrong that we're not willing to support anyone who tries this.
I'm currently investigating ways to properly support a single project that can target both Xbox 360 and Windows. We're getting close to trying to decide whether the amount of work required adds enough value to make it worthwhile (it's starting to look like a lot of work). We're also weighing the value of making it possible, but with certain restrictions in place so that some features are unsupported (ie, if you use them, they may or may not work -- this is obviously cheaper for us to implement).
How important would this feature be to you How frequently do you think you'd switch from one platform to another Do you know what a batch build is, and do you care about that feature
I'm interested in hearing your opinions on this subject (and the opinions of anyone else reading). It's hard for us to tell whether working with two projects is easy enough as it is -- which makes us wonder if we should put our effort into another feature.
If you were stack-ranking your wishlist for upgrades in the tools for our next version, where would "cross-platform project" stand
--Stephen
This is like #1 for me right now. Development goes a lot faster staying on the PC. Plus the xbox on my desk makes noise. . .
I'm looking at sharing code via assemblies now. Platform-specific stub projects with the bulk of the code in a shared assembly is certainly an acceptable work-around for me.
Here's another aspect to this question (if too far off topic, I'll start a new thread)
For the Xbox360 XNA is using the Compact Framework.
Does that make it easy to convert a game for a mobile platform And if so, that would be another Project type to consider.
Back to the Win/Xbox, can an XNA Class Libraries be used in a Windows XNA Project and a Xbox XNA Project
If you're talking about compiling one assembly and then referencing the same assembly from both your Xbox 360 and Windows game projects, I strongly recommend you do not do that. We do not support retargeting in that way -- meaning you can easily write code that will eventually fail on one platform or another.
If you decide to try anyway, note that it is an unsupported scenario and not likely to work as well as you'd hoped.
--Stephen
@Stephen Styrchak...
I think a cross-platform compiler would be used by many people, myself included. My plan is to develop on the PC first then port my game to the 360. A cross-platform compiler would DEFINITELY make this transition easier!
What I'm doing for now, and what is illustrated in the few examples, is wrapping platform-specific code with #if-#endif statements.
For example...
#if !XBOX
// perform mouse operations here
#endif
The examples in the help files use this method when, for example, calculating screen resolution and dimensions. At least this way, you don't have to keep two copies of the same code, you just have to break out the platform-specific code as separate algorithms (which you would have to do anyway).
This isn't "ideal" but for now, it's probably the easiest way to go.
Hope that helps!
Just to be clear, we use the same C# compiler for both platforms already. The difference is in the runtime and the framework. The XNA Framework API (the Microsoft.Xna.* class libraries used for XNA games) is already almost the same for both platforms. For the parts that differ, you will always need to use conditional-compilation flags so that you can re-use the same source files.
Right now, the way we recommend doing cross-platform development is to create a second project and add all the source files and content files from the original as links. That way, both projects share the same source files (you have to use Add As Link so that both project point to the same file instead of each getting their own copy).
Thanks for the feedback everyone.
--Stephen