I have a wix installer which collects some of its content files from
installed program-files.

 

For example, we use NLog, and the installer collects the DLL from the
NLog install location. 

We minimize configuration by searching the registry for the location
where NLog is installed, then using that value to populate a
preprocessor variable, which is then used in the WiX XML.

 

So, on our wix build properties tab, the 'define preprocessor variables'
textbox looks like this:

NLogInstallationPath=$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.N
ETFramework\v2.0.50727\AssemblyFoldersEx\NLog);

 

Then, the actual WiX Xml looks like this:

<File Id="DiagnosticsNLog" Name="NLog.dll"
Source="$(var.NLogInstallationPath)\NLog.dll" Vital="yes" />

 

This works really nicely, on a 32-bit machine.

It seems that on a 64-bit machine, even though Visual Studio is running
in 32-bit emulation-mode, the 64-bit hive is being used (I assume
MSBuild is being triggered in a native process, i.e. 64-bit shell), and
under that hive, the key 

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\Assembly
FoldersEx" does not exist.

instead - one must search the 32-bit sub-tree, which is this location

"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50
727\AssemblyFoldersEx"

 

To overcome this, I created TWO 'defines', one for 32-bit, and one for
64-bit (one of which will always be empty), then the WiX becomes this:

 

<?if $(env.PROCESSOR_ARCHITECTURE) = AMD64 ?>

        <File Id="DiagnosticsNLog" Name="NLog.dll"
Source="$(var.NLog64InstallationPath)\NLog.dll" Vital="yes" />

<?else?>

        <File Id="DiagnosticsNLog" Name="NLog.dll"
Source="$(var.NLogInstallationPath)\NLog.dll" Vital="yes" />

<?endif?>

 

Is this the correct way to achieve what I want (it does work), or is
there a functionality/syntax that I am unaware of for taking care of
this dilemma?

 

 

Thanks!

 

Adam Langley

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to