Visual C# 2008 Express
Well, I’ve been using Visual Studio Express (C#) as my development environment at home for a while now. I am use to standard Visual Studio Standard at work, but use Express at home. I’ve recently got a copy of Vista Home Basic (x64) and Visual C# 2008 Express builds “Any CPU” assemblies which seems to default to the current architecture. You can’t, at least via the interface that I can find, specify what assembly to produce (x86 x86) in Express. In standard you can setup build configurations for Debug/Release/x86/x64/Any CPU combinations. Express, on the other hand, is naff when it comes to this.
Long story short, I have been coding for Managed DirectX which are 32bit assemblies (x86) and my application level code has been compiling to x64 under Express as I have a 64bit machine. Result is a BadImageException at runtime as it load’s the 32bit Managed DirectX assembly from the GAC into a 64bit runtime application. Joy.
My solution has been to edit every one of my .csproj files manually to add the PlatformTarget tag like so:
<WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> </PropertyGroup>
I think I’m going to write an XNA renderer as hopefully XNA has 64bit assemblies…
Tags: C#, Managed DirectX, Visual Studio
May 14th, 2008 at 1:54 pm
It might be worth looking into NAnt (a port of Java’s Ant). You can use the platform attribute on the CSC task to define what target you wish to use (x86, x64, etc.), it could save you a lot of time with large solutions containing many projects.
September 27th, 2008 at 12:43 pm
A bit late but seeing that this article is still on the front page I thought I’d link a way of fixing the problem using the IDE instead of modifying the project files.
http://wfrobozz.blogspot.com/2008/09/visual-c-2008-express-and-3264-bit.html
December 18th, 2008 at 1:10 am
[...] folge dem Vorgehen von jenkz.org und editiere meine Projektdatei von Hand, indem ich in den zweiten PropertyGroup-Abschnitt die [...]