Wix registry editing not displayed in the msi log - wix

I've been working on a WIX .net project that needs to update a Microsoft registry entry to work correctly. While testing the logic, I found it difficult to debug the WIX components that updates the registry via the MSiexec.exe command line /log options. To verify the correct behaviour, I had to check the registry value manually. How do I force the WIX project to log the registry search and update logic from the following fragment in the MSI log output?
<util:RegistrySearch Id="Office2013RegistySearch"
Root="HKLM"
Key="SOFTWARE\Microsoft\Office\15.0\Access Connectivity Engine\Engines\Excel"
Value="TypeGuessRows"
Variable="Office2013GuessRowsx86Exist"
Win64="no"
Result="exists" />
<Component Id="Office2013GuessRowsx86RegComponent" Guid="CFE579F9-292A-4777-A671-B5E8E330B1A0" Win64="no">
<Condition>Office2013GuessRowsx86Exists</Condition>
<RegistryKey Root="HKLM"
Key="SOFTWARE\Microsoft\Office\15.0\Access Connectivity Engine\Engines\Excel" ForceDeleteOnUninstall="no">
<RegistryValue Type="integer" Name="TypeGuessRows" Value="0"/>
</RegistryKey>
</Component>

Try use full log
msiexec /i "dotnetproject.msi" /L*v "log.log"
or add <Property Id="MsiLogging" Value="voicewarmup"/> (for full log too)

Related

Wix install location

I have a WIX setup that allows the user to select the install location. When uninstalling, I need to run a custom action that should activate a file in the install location. I tried getting the install location from session["INSTALLDIR"] but it results in the default path and not the one given by the user.
How can I reach that location?
I've done this in my own installer - the following should work.
This adds a property to retrieve the install location value from the registry.
<Property Id="INSTALLDIR">
<RegistrySearch Id='Registry' Type='raw' Root='HKCU' Key='Software\$(var.Manufacturer)\$(var.ProductName)' Name='Location' />
</Property>
This sets the install location in the registry.
<Component Id="Registry" Guid="*">
<RegistryKey Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)">
<RegistryValue Name="Location"
Type="string"
Value="[INSTALLDIR]"
Action="write"
KeyPath="yes" />
</RegistryKey>
<util:RemoveFolderEx On="uninstall" Property="INSTALLDIR" />
If you want INSTALLDIR for a later time such as uninstallation you should use Remember property pattern described in link below.
"The root issue is that the Windows Installer does not save Property values for you. That means if the user enters values in the install UI or passes them on the command-line, those values will be not be present during repair, upgrade nor uninstall."
http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/

How to run .reg files when running the msi?

I am trying to understand how my setup.msi inserts registry values when installing it. In Orca editor I am seeing like this,
After installing the msi, in the log file I am seeing like this,
MSI (s) (A8:B4) [16:27:28:674]: Executing op: ComponentRegister(ComponentId={45667B7F-9DC7-43B7-BE9E-3215ED1B1985},KeyPath=02:\SOFTWARE\myCompany\MySolution\Plugins\MyProduct\ProductCode,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
I want to do the reverse engineering of this mechanism, can any one help me to understand this? I want to recreate the same using WIX, so I just tried like below
<Component Id="RegistryEntries" Guid="*">
<RegistryKey Root="HKLM"
Key="Software\Microsoft\MyCompany"
Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="MyApp" Value="[INSTALLLOCATION]" KeyPath="yes"/>
<RegistryValue Type="string" Name="Configuration Files" Value="[INSTALLLOCATIONCONFIG]"/>
<RegistryValue Type="string" Name="Configuration Files1" Value="[INSTALLLOCATIONCONFIG1]"/>
</RegistryKey>
</Component>
When I built the msi and if edit it Orca, I am seeing like below,
What should I do to get the msi as shown in the previous image?
MSI expresses registry data in the Registry table. During the installation, the system determines which features and components are being installed therefore which registry adds, updates and deletes to perform. The actual work is carried out by the WriteRegistryValues and RemoveRegistryValues actions.
It is not a best practice to "execute a reg file" during an installation because it's out of process and MSI can't manage the changes. Instead use the WiX Heat tool to harvest the contents of the registry file into wix xml source for inclusion in your installer.

Failed to create registry entry using WiX

The following code failed to create registry entry on Windows 7.
<Component Id='RegistryEntry1' Guid='1BECF977-A7A1-448E-8EC8-843A10E7F6D7' Directory='TARGETDIR'>
<RegistryKey Root='HKLM'
Key="SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v5.0\AssemblyFoldersEx\SimpleMvvmToolkit_2012.SL"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes">
<RegistryValue Type="string"
Value="C:\Program Files\SimpleMvvmToolkit_2012\Binaries\Silverlight\v5.0\"
KeyPath="yes"/>
</RegistryKey>
</Component>
What could be the problem?
If the registry key wasn't created, more likely than not, the Component was not installed. Check a verbose log file from the install, for example:
msiexec /i path\to\your.msi /l*v install.txt
In that log file you will see lines like:
Component: RegistryEntry1; Installed: Absent; Request: Local; Action: Local
I expect the Action will be None or something not Local. Then look up in the log file to see why the Component was not installed.
PS: The ForceCreateOnInstall and ForceCreateOnUninstall are not necessary unless you expect random values to be created under that registry key that you must remove on uninstall.

How to write a registry key and value in bundle of wix?

I can write a registry key and value in setup project of wix,the code like this:
<RegistryKey Id="WinApp" Root="HKLM" Key="Software\App\[ProductName]" Action="createAndRemoveOnUninstall" >
<RegistryValue Type="string" Name="InstallName" Value="[ProductName]" Action="write" KeyPath="yes"></RegistryValue>
</RegistryKey>
How can i do in bootstrapper project?
Bundles do not modify the machine state. The registry key should be placed in one of the chained packages to be part of the installation transaction.

How to execute VSTO post-install by WiX

I need to run some VSTOs after they been installed. Everything I tried came out negative.
One example:
<Property Id="runcmd">start</Property>
<CustomAction Id="RunOutlookVSTO"
Property="runcmd"
Execute="deferred"
Return="asyncNoWait"
ExeCommand="[SourceDir]Outlook2010AddIn.vsto">
</CustomAction>
<InstallExecuteSequence>
<Custom Action="RunOutlookVSTO"
After="PublishProduct">NOT INSTALLED</Custom>
</InstallExecuteSequence>
Error: No reaction.
Second example: replace start with cmd
Error: No reaction.
Third example: Replace start with msiexec and msiexec /i
Error: msiexec help screen and "did not find any msi to exec"
Fourth example: <Custom action id="RunOutlookVSTO" etc>
Error: Does not understand custom at compile.
EDIT:
Seems to be a bit of a confusion, just to be clear - yes I tried the registry key, and it is being ignored by the Office applications (Outlook, Word, Excel).
<RegistryKey Action="none" Root="HKLM" Key="SOFTWARE\Microsoft\Office\14.0\User Settings\">
<RegistryKey Id="CreateVSTOOutlook" Action="createAndRemoveOnUninstall"
Key="OUR.Outlook2010AddIn\Create\Software\Microsoft\Office\Outlook\Addins\OUR.Outlook2010AddIn">
<RegistryValue Id="CmdLineOutlook" Name="CommandLineSafe" Value="1" Type="integer"></RegistryValue>
<RegistryValue Id="descOutlook" Name="Description" Value="Tilføjelsesprogram til Outlook 2010" Type="string"></RegistryValue>
<RegistryValue Id="nameOutlook" Name="FriendlyName" Value="Outlook 2010 AddIn" Type="string"></RegistryValue>
<RegistryValue Id="LoadOutlook" Name="LoadBehavior" Value="3" Type="integer"></RegistryValue>
<RegistryValue Id="manifestOutlook" Name="Manifest" Value="[INSTALLDIR]OUR.Outlook2010AddIn.vsto|vstolocal" Type="string"></RegistryValue>
</RegistryKey>
</RegistryKey>
Any ideas what I could try next?
Vsto addins are not standalone programs you can execute. They are dll's that get loaded and then called by the respective office programs through a special bootstrapper.
In your case starting OUTLOOK should load the addin (if it's registered properly). And nothing else will.
-- EDIT --
The .vsto file extension gets associated with the VstoInstaller.exe which is the program you try to run. Note that the vsto file is not a program and as such can't be executed/run. It is a configuration file that is understood by the vstoinstaller (program).
For a default installation VSTOInstaller.exe can be found in
C:\Program Files\Common Files\microsoft shared\VSTO\10.0\VSTOInstaller.exe
it has a /help switch but the install syntax is:
VSTOInstaller.exe /i \servername\foldername\AddIn.vsto
for more info see this msdn link