BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD
DeltaEngine

Getting XNA to work in Windows XP x64

by Benjamin Nitschke 27. August 2006 19:19
As some of you might know I am a Windows XP x64 User for a while now. x64 Bit works great and most issues could be resolved one way or another. As I wrote in my Windows x64 post a few weeks back it is very important to make sure Managed DirectX uses always x86 (32 bit) as the target platform. x64 is NOT supported and "Any CPU" will work on 32 bit because it will use x86 automatically, but on x64 bit platforms, x64 will be choosed. Since calling 32 bit dlls (which all Managed DirectX dlls are) is not possible from x64, you have to have your whole app in 32 bit mode!

Same thing for XNA, which uses 32 bit and the release coming out in a few days will also support only x86 (32 bit). Since XNA Game Studio Express is based on Visual C# Express, which does not support switching from Any CPU to x86, it is NOT possible to run any XNA game or XNA code out of the box. While Visual Studio 2005 allows us to switch from Any CPU to x86, we cannot use the templates or even open the XNA projects (you get a error message like "this project type is not supported").

There is a simple trick, which also works for Visual C# Express, if you want to support x64 platforms too (no matter which platform you use yourself):

Add the following line into each PropertyGroup item of your csproj file in a text editor:

  <PlatformTarget>x86</PlatformTarget>

Or if you just want to copy the full PropertyGroups for the default Debug and Release configurations, copy this into your csproj file and overwrite the old Debug and Release PropertyGroups items.

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoStdLib>true</NoStdLib>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoStdLib>true</NoStdLib>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>

Now XNA runs fine on x64 bit. Happy developing (ok, you have to wait till the 30. august, haha).

Update: An even better solution might be to directly change the template files located at
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCSExpress\ProjectTemplates\1033\
There you can find the Xna templates as zip files. Just extract them, edit the .csproj files and save it as a .zip file again. I can provide you with the updated .zip files as soon as XNA is released (in case this doesn't get implemented anyways).
Also make sure to update the cache for these files at (just extract the .zip files there):
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCSExpress\ProjectTemplatesCache\1033\

Update 2006-08-30: Download this file (Xna64BitSupport.zip 14 KB)
and extract it to:
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCSExpress\
Thats all. This will replace your XNA Game and XNA Library template .zip and cache files.

Comments


8/30/2006 11:59:30 PM #

Thank you for this easy fix. I was very peaved when I first ran the demo code for the XNA framework on my x64 Vista as I was hoping to convert my Game Engine tutorials today over to the XNA framework. This simple fix works perfectly and will let me get on with the real coding. Thanks again.

Michael Schuld | Reply



8/31/2006 12:53:11 AM #

Well now, that was incredibly helpful.  Thanks.

Andy | Reply



9/9/2006 4:44:58 AM #

I did not need to manually edit anything, you can open the configuration manager, select New... in the Active solution platform, select "x86" and copy settings from "Any CPU" (make sure create solution configurations is checked too).

redwyre | Reply



9/9/2006 9:32:36 PM #

There is no configuration manager in Express and thats the whole point of this article.
Sure it is easy with Visual Studio 2005 Professional, but XNA is not supported for that IDE.

abi | Reply



9/29/2006 5:05:11 AM #

I was wondering. I am currently using Windows XP Professional x64. Will this fix also work for that platform? I  have done so many things I do not know whats what anymore. I did install C# 2005 Express first, then installed the XNA. Now the first couple of few times I tried things of course it didin't work so I uninstalled the XNA.

I have since reinstalled the XNA and came upon this artical and tried the copy over of the zip files as described in the update. I tried again to create one of the kits, spacewar, as well as a default xna starting kit. They both compile fine, all seems ok. soon as you try to run without or run with debug the system seems to hang for a few moments and the "report the fatal error to ms window shows"  and the application terminates obviously.

Is there a place still one can get Visa(legally like join the beta or something) x64 or any other information I should look at to solve this. Like a fool I wasn't reading the small print or should say kind of the lacking (or I missed it) that it didnt yet support the x64 platform(s) as I am normaly a user of Windows2003 and figured couldnt hurt with compile times and such to use my amd fx2 3000+ ..

I wish I could leave as happy a message behind as the others have, but maybe you can shed some other light on things I may have missed or might be able to do that will support my current OS. Who knows when MS will get the x64 stuff in, and im guessing we wont see it until the pro release comes out.

Thanks in advance for your concideration of this problem.

Matthew

MRandall | Reply



4/18/2010 5:35:19 PM #

Awesome stuff you guys got here.  I really like the theme of the website and how well you organized the content.  It's a marvelous job I will come back and check you out sometime.

us | Reply



5/4/2010 5:02:24 PM #

Ambition, like a torrent, never looks back.

pay day loans | Reply


Add comment




biuquote
  • Comment
  • Preview
Loading



Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum

Poll

Which platform should Soulcraft be released on next?











Show Results Poll Archive

Recent Games

Soulcraft

Fireburst

Jobs @ exDream

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910