Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

32 and 64 bit assemblies in one windows installer

I have an application written in C# which depends on sqlite managed provider. The sqlite provider is platform dependent (there are two dlls for 32 and 64 bit applications with the same name). The application loads the desired one at runtime based on OS.

The problem is that while creating an installer I cannot add 64 bit mode dll to the setup project as I am getting the following error: File '' targeting '' is not compatible with the project's target platform ''.

I would use other installer but I have a custom action which must be invoked during the setup.

So I wanted to know if there is an installer which will let me add 32 and 64 bit dll to it and execute custom action written in C#.

One possible solution is to have two installers but I would like to avoid it if possible.

Any suggestions?

like image 504
Giorgi Avatar asked Apr 28 '10 20:04

Giorgi


People also ask

Can I install both 32 and 64-bit Windows?

The 32-bit and 64-bit versions of Office programs aren't compatible, so you can't install both on the same computer.

How do I know if installer is 32 or 64-bit?

Open the Task Manager by simultaneously pressing the Ctrl + Shift + Esc keys on your keyboard. Then, click on the Processes tab. In the Processes tab, you see the list of processes that are running at the moment. If a program is 32-bit, near its name you should see the text: *32.

What is x86 and x64 in Visual Studio?

The Win32 platform name is used for C++ projects, and it means x86. Visual Studio considers both project-level platforms and solution-level platforms, and the project platforms come from the language-specific project systems. C++ projects use Win32 and x64, but the solution platforms use x86 and x64.

Which Windows Installer is best?

Renewal by Andersen, LLC: Best Overall We selected Renewal by Andersen as the overall best window installation company because of its high-quality windows, stellar reputation, outstanding customer service, and considerable warranty.


2 Answers

The Inno Setup Installer support the feature wich you request, this installer is very flexible and reliable, exist many samples of scripts in the web to make a conditional installation depending of the architecture of the final client.

Check this script located in C:\Program Files\Inno Setup 5\Examples\64BitThreeArch.iss

 -- 64BitThreeArch.iss --
; Demonstrates how to install a program built for three different
; architectures (x86, x64, Itanium) using a single installer.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
; "ArchitecturesInstallIn64BitMode=x64 ia64" requests that the install
; be done in "64-bit mode" on x64 & Itanium, meaning it should use the
; native 64-bit Program Files directory and the 64-bit view of the
; registry. On all other architectures it will install in "32-bit mode".
ArchitecturesInstallIn64BitMode=x64 ia64

[Files]
; Install MyProg-x64.exe if running on x64, MyProg-IA64.exe if
; running on Itanium, MyProg.exe otherwise.
Source: "MyProg-x64.exe"; DestDir: "{app}"; DestName: "MyProg.exe"; Check: IsX64
Source: "MyProg-IA64.exe"; DestDir: "{app}"; DestName: "MyProg.exe"; Check: IsIA64
Source: "MyProg.exe"; DestDir: "{app}"; Check: IsOtherArch
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme

[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

[Code]
function IsX64: Boolean;
begin
  Result := Is64BitInstallMode and (ProcessorArchitecture = paX64);
end;

function IsIA64: Boolean;
begin
  Result := Is64BitInstallMode and (ProcessorArchitecture = paIA64);
end;

function IsOtherArch: Boolean;
begin
  Result := not IsX64 and not IsIA64;
end;
like image 87
RRUZ Avatar answered Sep 25 '22 17:09

RRUZ


With Windows Installer, no. You'll need two setups.

However NSIS is quite capable of handling both platforms in a single setup with runtime detection. It really depends if you're targeting Enterprise users or not, Enterprise customers will require Windows Installer (MSI) packages while your average internet user doesn't care :)

like image 22
saschabeaumont Avatar answered Sep 22 '22 17:09

saschabeaumont