.NET: One line could save your 64-bit bacon!


I have a customer that recently had to purchase a new computer due to her previous computer finally biting the dust.  Knowing what programs she was running on her computer, I advised her that she should purchase a 32-bit version of Vista (then upgrade to the 32-bit version of Windows 7 when it came out).

She bought a 32-bit machine that was running Vista and everything seemed fine except the OS was corrupt.  So she took the computer back in to have it replaced and they gave her a shiny new Windows 7 machine (she was only days away from the release of Windows 7) .  She asked them to give her the same computer, but they gave her a 64-bit version of Windows 7 so when she went to install her programs she ran into a ton of problems because the programs were not written for the 64-bit versions of the operating system (a lot of legacy applications are not written for 64-bit operating systems, this isn’t Microsoft’s fault, this is a fault of the application programmers).

I have a small application that I wrote that for ease of use and not having to install any other programs, I chose to use Microsoft Access as the database for the application (say what you will, it was a side project that turned into something I could sell), but there is no 64-bit JET driver for reading Access databases so for 64-bit operating systems, I was hosed, until I found out that one line could change everything.

In the csproj file of your C# .NET application, in the first property group, add this line:

<PlatformTarget>x86</PlatformTarget>

So your property group should look something like this:

<PropertyGroup>
<PlatformTarget>x86</PlatformTarget>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A16625F1-A4BA-46FA-BD05-737257A18EBD}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UPurMEMORY</RootNamespace>
<AssemblyName>UPurMEMORY</AssemblyName>
<ApplicationIcon>UPurMEMORY.48.ico</ApplicationIcon>
<FileUpgradeFlags></FileUpgradeFlags>
<UpgradeBackupLocation></UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>

That one little line saved my bacon and allows me to sell that piece of software for $10 to anyone who runs a 64-bit operating system.  I’m not saying this will solve all of your problems, but it helped me.

Related Links:

UPurMEMORY – memorization utility ($10.00 USD)
Windows 7 Home Premium (upgrade)
Windows 7 Professional (upgrade)
Windows 7 Ultimate (upgrade)

Related Posts:

What’s the big deal about Windows 7?

Share


Comments are closed.