0

I have an application that needs 1. to create DLL files in a Program Files subfolder (e.g. C:\Program Files (x86)\myapp), and 2. to create a registry entry in HKCU. When I run the Remove, I need this subfolder and its files to be deleted, as well as the registry entry. When I run the installation file of a newer version, I need the new DLL files to replace the existing ones.

I've been struggling getting it to work, having tried several tips from various threads and sites. So far I get the Program Files to be removed but not the Registry. And I cannot get the file upgrade to work (I change the UpgradeCode & ProductVersion for each new release)

Here is an extract of what I have

    <Product Id="$(var.ProductID)"
               Name="myapp"
           Language="1033"
           Version="$(var.ProductVersion)"
           UpgradeCode="$(var.UpgradeCode)"
           Manufacturer="$(var.Manufacturer)">    
    <Package Description="Windows installer for myApp $(var.ProductVersion)"
             Comments="Execute to install myApp $(var.ProductVersion)"
            InstallerVersion="200"
            Compressed="yes" />     
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion Minimum="$(var.ProductVersion)"
                     OnlyDetect="yes"
                      Property="NEWERVERSIONDETECTED" />
      <UpgradeVersion Minimum="1.0.0.0"
                      IncludeMinimum="yes"
                      Maximum="$(var.ProductVersion)"
                      IncludeMaximum="no"
                      Property="OLDERVERSIONBEINGUPGRADED" />
    </Upgrade>
    <CustomAction Id="UIandAdvertised" Error="Something about the UI."/>
        <Directory Id="TARGETDIR" Name="SourceDir"/>        
        <Feature Id="Complete"
               Title="myApp"
               Description="Installation of myApp $(var.ProductVersion)"
               Level="1">
             <ComponentRef Id="myAppFiles"/>
                 <ComponentRef Id="RegistryEntry"/>
        </Feature>
    <Property Id="WIXUI_INSTALLDIR">INSTALLDIR</Property>
    <UIRef Id="WixUI_InstallDir"/>    
    <InstallExecuteSequence>
      <RemoveExistingProducts Before="InstallInitialize" />
      <RemoveRegistryValues />
    </InstallExecuteSequence>
  </Product>

My files and reg infos are maintained in a separate file:

<Fragment>
        <DirectoryRef Id="TARGETDIR">
            <Directory Id="ProgramFilesFolder" Name="PFiles">
                <Directory Id="INSTALLDIR" Name="myapp">
                    <Component Id="myAppFiles" Guid="{xxxx-xxxx-xxxx-xxxx-xxxxxxxx}">
          <File Id="myapp.dll" Name="myapp.dll" KeyPath="yes" Source="..\src\bin\x86\Release\myapp.dll" />
          </Component>
                    <Component Id="RegistryEntry" Guid="{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx}" Win64="no" >
                        <RegistryKey Root="HKCU" Key="Software\myapp" Action="createAndRemoveOnUninstall">
              <RegistryValue Type="string" Value="myapp" />
            </RegistryKey>
                    </Component>
                </Directory>
            </Directory>
        </DirectoryRef>

Any help will be highly appreciated.

gf_uml
  • 19
  • 4
  • Regarding upgrades, see this answer: http://stackoverflow.com/a/3575801/1202501 – BryanJ Dec 02 '15 at 03:42
  • DO NOT change the upgrade code or else your upgrades won't work. – BryanJ Dec 02 '15 at 03:43
  • Also, when uninstalling, the installer should remove files and registry entries that it installed. If not, you can try running the msi and uninstallint with logging to see why registry entries aren't removed. Ex: msiexec /x /lvoicewarmup . Since the reg entries are under HKCU, maybe you aren't uninstalling as the same user that installed the application? – BryanJ Dec 02 '15 at 03:45
  • Thanks for your replies. I managed to get the RegEntry to be removed with _ _. If I don't change the UpgradeCode and leave the same Product ID guid, I get the error message "another version is already installed...". If I use the * for the ProductID, it works to some extent by it lets me runs the installation of an older version. It seems difficult to get all the properties I need – gf_uml Dec 02 '15 at 07:54
  • Make sure you increment your version number – BryanJ Dec 02 '15 at 13:56

1 Answers1

0

Use Product ID ="*", It changes product id guid for each build. But keep upgrade code same for product, unless you dont want to support upgrade.

You can use major upgrade tag instead of Upgrade tag. It is easier to use.

<MajorUpgrade AllowDowngrades="no"
              AllowSameVersionUpgrades="no"
              Schedule="afterInstallValidate"
              DowngradeErrorMessage="Newer version of [ProductName] is already installed."/>
Ashish Kamat
  • 567
  • 4
  • 16
  • Using ProductID=* leads to issues: running the installation of a newer version doesn't replace the DLLs with the newer version. If I remove my Upgrade & ExecSequence to use MajorUpgrade instead, uninstalling the application doesn't delete anything (files, regentries) – gf_uml Dec 02 '15 at 10:09
  • Uninstallation should be taken care of by installer. Also is it requirement that registries be made in HKCU and not in HKLM. Why is installer not running in per machine install scope? – Ashish Kamat Dec 03 '15 at 03:57
  • sorry didnt check question properly.Can you change action for registry key to write. I normally use the same. I have not faced any problem where registry is not uninstalled normally. – Ashish Kamat Dec 03 '15 at 05:52
  • I eventually found a solution. I turned out that I had to change the way I managed my versions. I used to change "z" in "x.y.z" for a new minor version -> moving to changing the 2nd digit (y) sorted my issue. – gf_uml Dec 03 '15 at 13:12