Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mix x86 and x64 DLLs into the same MSI package?

I'm working on a .NET profiler and I need to build 2 DLLs for 64bit machines (one for x86 compatible applications and the other for x64 ones). I want to create a single MSI that contains the 2 DLLs. Is this possible?

like image 322
Kira Avatar asked Oct 18 '25 21:10

Kira


1 Answers

Yes, you can create a single MSI to install the files. However, MSI packages are either 32-bit or 64-bit. A 64-bit MSI package cannot install on a 32-bit machine and a 32-bit package cannot install to 64-bit locations. So, if you are okay with your 64-bit binaries being installed to 32-bit locations (like C:\Program Files (x86)\) then you can just add Conditions to your Components to get the right bits installed.

For example using the WiX toolset the code could look like:

<Component>
  <Condition>NOT VersionNT64</Condition>

  <File Source='path\to\32bit.dll' />
<Compnent>

<Component>
  <Condition>VersionNT64</Condition>

  <File Source='path\to\64bit.dll' />
<Compnent>
like image 184
Rob Mensching Avatar answered Oct 22 '25 08:10

Rob Mensching



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!