Search code examples
.net-3.564-bitsetup-projectanycpu

How can I use a VS Setup Project to install "Any CPU" code properly on either 32-bit or 64-bit Windows?


We have a large suite of products that include:

  • Desktop apps written in VB6.
  • Desktop apps written in .NET.
  • Windows services written in .NET.
  • ASP.NET web apps written in .NET.
  • ASMX and WCF services written in .NET.

All the .NET code is written in VS2008, targeting .NET 3.5 and "Any CPU". We could target specific processors, but would prefer not to because it would cause problems further down the dependency tree. We are not yet in a position to move anything to .NET 4.0, although it will become an option later on.

All the apps share a few vital registry keys. We have got round the registry redirection issue by having the .NET code always look at the 32-bit registry view.

Some of the .NET code talks to VB6 DLLs via COM interop, but that is very limited and we can easily remove this dependency (comment out now, re-write in .NET later).

All the web apps and services are designed to be hosted in IIS. All versions from 5.1 onwards need to be supported.

Our build VMs are currently running Windows XP (32-bit). We could create new ones if necessary.

My assignment is to make sure that everything runs without problems on 64-bit Windows (all versions). I am currently having trouble with the .NET setup projects, all of which are written using the VS2008 setup project templates.

Even though the source code is Any CPU, the setup projects don't have this feature. You have to set the TargetPlatform property to one processor. This is not very useful. Can't we have one setup.exe that installs as 32-bit on a 32-bit O/S and as 64-bit on a 64-bit O/S? If I was an end user installing the apps, I wouldn't know which setup program to run.


Solution

  • I have since investigated VS2010 setup projects, WiX, and InstallShield, and all of them behave the same way. I'm going to have to write this question off as "not possible". I intend to do either:

    • Just provide separate 32 and 64 bit installers.
    • Write a separate loader batch file or exe to detect the bitness and run the appropriate installer.