Photography

Monday, 27 January 2014

64-bit Installer Issues

Recently, I encountered a problem where my 64-bit Windows Service installers were failing to correctly install (failing to install at all, to be fair..).  After a little digging around I found a post that detailed that, despite correct configuration Visual Studio builds the MSI incorrectly, causing execution to fail.


It turns out that even though you set the projects to compile for 64-bit, when the MSI is built the 32-bit version of InstallUtilLib.dll is added which causes the installation to fail.


To overcome this problem, simply follow these steps:
  1. Make sure that you go into the Properties => Build tab for every project and set the Target Platform to x64. 
  2. Click on your Installation project and then Properties and ensure that the Target Platform is x64.
  3. Build your solution - if the solution does not compile, right click and "Unload Project" and then "Load Project" for those projects whose references fail (I found this step was necessary for me).
  4. Go to http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3138 and download and install the "7.0 Istaller SDK".
  5. Go into the C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin folder and install Orca. 
  6. Run Orca and open your project's MSI.
  7. Select the "Binary" table.
  8. Double click the cell "[Binary Data]" for the record "InstallUtil".
  9. Make sure "Read binary from filename" is selected.
  10. Browse to C:\Windows\Microsoft.NET\Framework64\v4.0.30319 
  11. Select "InstallUtilLib.dll"
  12. Click the Open button, hit OK and then save the MSI.

That is it - you can now deploy and the x64 installation should work without any further issues.  

The only down side to this is that you have to do this every time you build the MSI; it is probably possible to generate a transform file if you have experience with these things, but in my attempt I found that there is a subtle difference in how VS builds the MSI against how ORCA interprets MSIs, meaning ORCAs assumptions on some MSI elements are not compatible and the transform fails.


If you find this useful, please share! :)