Wix安装程序升级和删除文件+注册表项



我有一个需要1的应用程序。在Program files子文件夹(例如C:\Program files(x86)\myapp)中创建DLL文件,以及2。在香港中文大学创建注册表项。当我运行Remove时,我需要删除此子文件夹及其文件,以及注册表项。当我运行新版本的安装文件时,我需要新的DLL文件来替换现有的DLL文件。

我一直在努力让它发挥作用,尝试了来自不同线程和网站的几个技巧。到目前为止,我得到的程序文件被删除,但不是注册表。我无法使文件升级工作(我为每个新版本更改UpgradeCode&ProductVersion)

这是的摘录

    <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>

我的文件和注册信息保存在一个单独的文件中:

<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="..srcbinx86Releasemyapp.dll" />
          </Component>
                    <Component Id="RegistryEntry" Guid="{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx}" Win64="no" >
                        <RegistryKey Root="HKCU" Key="Softwaremyapp" Action="createAndRemoveOnUninstall">
              <RegistryValue Type="string" Value="myapp" />
            </RegistryKey>
                    </Component>
                </Directory>
            </Directory>
        </DirectoryRef>

如有任何帮助,我们将不胜感激。

使用产品ID="*",它为每个生成更改产品id guid。但保持产品的升级代码不变,除非您不想支持升级。

您可以使用主升级标记而不是升级标记。它更容易使用。

<MajorUpgrade AllowDowngrades="no"
              AllowSameVersionUpgrades="no"
              Schedule="afterInstallValidate"
              DowngradeErrorMessage="Newer version of [ProductName] is already installed."/>

最新更新