Wix安装程序不会覆盖可执行文件的早期版本

德米特里·斯特雷布连科

我有一个非常简单的安装程序-将单个dll复制到Program Files子文件夹,然后将其注册到regsvr32.exe。效果很好,但是如果安装了旧版本的dll,则“修复”不会覆盖现有的dll。DLL已签名,并且其版本(内部版本)号始终递增(例如2.0.0.123-> 2.0.0.124)。

查看以前的类似文章,我添加了RemoveExistingProducts并将ProductId指定为“ *”。卸载然后再安装较新的版本效果很好,但是我确实需要修复以更新现有的dll。

我还有什么需要做的吗?

谢谢!

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <!--
When creating a new install for the next version, these fields must be modified
-->
  <?define ProductVersion = "2.0.00" ?>

  <?define ProductId64 = "*" ?>
  <?define ProductId32 = "*" ?>

  <?define PackageId   = "45F34788-66AC-441C-B666-707FFA7F1EE9" ?>


  <!-- Product name as you want it to appear in Add/Remove Programs-->
  <?if $(var.Platform) = x64 ?>
  <?define ProductName = "XYZ (64 bit)" ?>
  <?define Win64 = "yes" ?>
  <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
  <?define ProductId = "$(var.ProductId64)" ?>
  <?define MainDllName = "XYZ64.dll" ?>
  <?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?>
  <?else ?>
  <?define ProductName = "XYZ (32 bit)" ?>
  <?define Win64 = "no" ?>
  <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
  <?define ProductId = "$(var.ProductId32)" ?>
  <?define MainDllName = "XYZ.dll" ?>
  <?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?>
  <?endif ?>


  <?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?>


  <Product Id="$(var.ProductId)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Advanced Messaging Systems LLC" UpgradeCode="$(var.UpgradeCode)">

    <Package Id="$(var.PackageId)" InstallerVersion="200" Compressed="yes" Description="XYZ Installer package"  InstallPrivileges="elevated"/>

    <!-- No restore point  -->
    <Property Id="MSIFASTINSTALL" Value="3" />

   <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="$(var.PlatformProgramFilesFolder)">
        <Directory Id="INSTALLLOCATION" Name="XYZ">

          <Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D">
            <File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" />

            <!-- TODO: Insert files, registry keys, and other resources here. -->
          </Component>

        </Directory>
      </Directory>
    </Directory>

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />

    <!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe -->
    <CustomAction Id="RegisterDll"
                      Directory="INSTALLLOCATION"
                      ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'

                      Return="check">
    </CustomAction>
    <CustomAction Id="UnregisterDll"
                  Directory="INSTALLLOCATION"
                  ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'>
    </CustomAction>


    <Feature Id="ProductFeature" Title="XYZ" Level="1">
      <ComponentRef Id="XYZDll" />
      <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
      <ComponentGroupRef Id="Product.Generated" />
    </Feature>

    <InstallUISequence>
      <Custom Action="WixCloseApplications" Before="AppSearch"/>
    </InstallUISequence>

    <InstallExecuteSequence>

      <!-- Uninstall previous version before installing this one. -->
      <RemoveExistingProducts Before="InstallInitialize"/>


      <SelfRegModules/>
    </InstallExecuteSequence>

    <Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/>
    <Property Id="ARPPRODUCTICON" Value="XYZ.ico" />

    <!-- UI -->
    <UIRef Id="WixUI_InstallDir"/>
    <UIRef Id="WixUI_ErrorProgressText" />

    <WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" />
    <WixVariable Id="WixUIBannerBmp"  Value="..\Graphics\banner.jpg" />
    <WixVariable Id="WixUIDialogBmp"  Value="..\Graphics\logo.jpg" />


    <!-- End UI -->
  </Product>
</Wix>

更新修改升级条目后,以下内容对我有用:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <!--
When creating a new install for the next version, these fields must be modified
-->
  <?define ProductVersion = "2.0.4" ?>

  <?define ProductId64 = "*" ?>
  <?define ProductId32 = "*" ?>

  <?define PackageId   = "*" ?>


  <!-- Product name as you want it to appear in Add/Remove Programs-->
  <?if $(var.Platform) = x64 ?>
  <?define ProductName = "XYZ (64 bit)" ?>
  <?define Win64 = "yes" ?>
  <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
  <?define ProductId = "$(var.ProductId64)" ?>
  <?define MainDllName = "XYZ64.dll" ?>
  <?define MainDllSource = "..\..\bin\Win64\Release\XYZ64.dll" ?>
  <?else ?>
  <?define ProductName = "XYZ (32 bit)" ?>
  <?define Win64 = "no" ?>
  <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
  <?define ProductId = "$(var.ProductId32)" ?>
  <?define MainDllName = "XYZ.dll" ?>
  <?define MainDllSource = "..\..\bin\Win32\Release\XYZ.dll" ?>
  <?endif ?>


  <?define UpgradeCode = "{C3763742-7C1C-4AB7-A404-F030B7550E97}" ?>


  <Product
    Id="$(var.ProductId)"
    Name="$(var.ProductName)"
    Language="1033"
    Version="$(var.ProductVersion)"
    Manufacturer="Advanced Messaging Systems LLC"
    UpgradeCode="$(var.UpgradeCode)"
    >

    <Package Id="$(var.PackageId)"
             InstallerVersion="200"
             Compressed="yes"
             Description="XYZ Installer package"
             InstallPrivileges="elevated"
     />

    <!-- No restore point  -->
    <Property Id="MSIFASTINSTALL" Value="3" />


    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion Minimum="1.0.0"
                      IncludeMinimum="yes"
                      OnlyDetect="no"
                      Maximum="$(var.ProductVersion)"
                      IncludeMaximum="no"
                      Property="PREVIOUSFOUND" />
    </Upgrade>


    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="$(var.PlatformProgramFilesFolder)">
        <Directory Id="INSTALLLOCATION" Name="XYZ">

          <Component Id="XYZDll" Guid="E2CBEE41-6C0E-4A84-95C1-7282747B4A3D">
            <File Id='MainDll' Name="$(var.MainDllName)" DiskId='1' Source="$(var.MainDllSource)" SelfRegCost="0" />

            <!-- TODO: Insert files, registry keys, and other resources here. -->
          </Component>

        </Directory>
      </Directory>
    </Directory>

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />

    <!-- Note: Custom actions to install/uninstall the dll using regsvr32.exe -->
    <CustomAction Id="RegisterDll"
                      Directory="INSTALLLOCATION"
                      ExeCommand='regsvr32.exe /s "[INSTALLLOCATION]$(var.MainDllName)"'

                      Return="check">
    </CustomAction>
    <CustomAction Id="UnregisterDll"
                  Directory="INSTALLLOCATION"
                  ExeCommand='regsvr32.exe /s /u "[INSTALLLOCATION]$(var.MainDllName)"'>
    </CustomAction>


    <Feature Id="ProductFeature" Title="XYZ" Level="1">
      <ComponentRef Id="XYZDll" />
      <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
      <ComponentGroupRef Id="Product.Generated" />
    </Feature>

    <InstallUISequence>
      <Custom Action="WixCloseApplications" Before="AppSearch"/>
    </InstallUISequence>

    <InstallExecuteSequence>

     <RemoveExistingProducts After="InstallInitialize"/>

      <SelfRegModules/>

    </InstallExecuteSequence>

    <Icon Id="XYZ.ico" SourceFile="..\Graphics\XYZ.ico"/>
    <Property Id="ARPPRODUCTICON" Value="XYZ.ico" />

    <!-- UI -->
    <UIRef Id="WixUI_InstallDir"/>
    <UIRef Id="WixUI_ErrorProgressText" />

    <WixVariable Id="WixUILicenseRtf" Value="..\EULA\license.rtf" />
    <WixVariable Id="WixUIBannerBmp"  Value="..\Graphics\banner.jpg" />
    <WixVariable Id="WixUIDialogBmp"  Value="..\Graphics\logo.jpg" />


    <!-- End UI -->
  </Product>
</Wix>
菲尔·DW

如果要进行重大升级,请从WiX MajorUpgrade元素开始。升级的一般规则是:

  1. 与旧产品不同的ProductCode和PackageCode。
  2. 在前三个字段中的某处增加ProductVersion。
  3. 与旧产品相同的UpgradeCode。
  4. 做一些事情(例如Wix MajorUprade或Upgrade元素),以确保已进行升级。
  5. 每用户安装将不会升级每系统安装,反之亦然。

在您的原始情况下,不遵循规则1和2意味着Windows认为已经安装了同一产品,并进入了修复模式。那应该是您的第一个警告,因为主要升级看起来像是全新安装,而不是维修。如果您在“程序和功能”中有两个条目,则表示这4个要求中的一项或多项没有得到满足。如果您收到“已经安装了该产品的另一个版本”,则表示您没有遵循规则1,并且与安装的产品相比,行为上的差异是有关ProductCode和PackageCode值的。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

安装的程序可执行文件从错误的位置运行

来自分类Dev

MSI 安装程序的可执行文件

来自分类Dev

如何安装可执行文件

来自分类Dev

具有提升的自定义操作的提升的安装程序不会提升可执行文件

来自分类Dev

具有提升的自定义操作的提升的安装程序不会提升可执行文件

来自分类Dev

可执行文件包装程序,从PATH的末尾运行原始可执行文件

来自分类Dev

生成安装程序可执行文件后添加文件

来自分类Dev

覆盖正在运行的可执行文件或.so

来自分类Dev

如何更改Unix可执行文件的默认版本?

来自分类Dev

如何找到javadoc可执行文件的版本?

来自分类Dev

Eclipse C ++安装程序,未设置可执行文件的路径

来自分类Dev

从VSIX安装程序包运行shell命令或可执行文件?

来自分类Dev

生成的安装程序会创建指向错误可执行文件的快捷方式

来自分类Dev

包装并使用安装程序后,Windows上的可执行文件未退出

来自分类Dev

Eclipse C ++安装程序,未设置可执行文件的路径

来自分类Dev

生成的安装程序会创建指向错误可执行文件的快捷方式

来自分类Dev

Windows:从Store安装的应用程序的可执行文件在哪里?

来自分类Dev

在Debian中安装应用程序/ x可执行文件

来自分类Dev

找到新安装的应用程序“Beyond Compare”的可执行文件

来自分类Dev

cabal通过沙箱从Hackage安装可执行文件?

来自分类Dev

在Cabal中定义未安装的可执行文件

来自分类Dev

安装perlbrew:无法检索patchperl可执行文件

来自分类Dev

从软件包安装的可执行文件列表

来自分类Dev

通过JSPM安装后运行可执行文件

来自分类Dev

安装pylint OSX省略可执行文件

来自分类Dev

Homebrew在哪里安装Postgres可执行文件?

来自分类Dev

使用nsis安装可执行文件的特权

来自分类Dev

从软件包安装的可执行文件列表

来自分类Dev

安装perlbrew:无法检索patchperl可执行文件

Related 相关文章

  1. 1

    安装的程序可执行文件从错误的位置运行

  2. 2

    MSI 安装程序的可执行文件

  3. 3

    如何安装可执行文件

  4. 4

    具有提升的自定义操作的提升的安装程序不会提升可执行文件

  5. 5

    具有提升的自定义操作的提升的安装程序不会提升可执行文件

  6. 6

    可执行文件包装程序,从PATH的末尾运行原始可执行文件

  7. 7

    生成安装程序可执行文件后添加文件

  8. 8

    覆盖正在运行的可执行文件或.so

  9. 9

    如何更改Unix可执行文件的默认版本?

  10. 10

    如何找到javadoc可执行文件的版本?

  11. 11

    Eclipse C ++安装程序,未设置可执行文件的路径

  12. 12

    从VSIX安装程序包运行shell命令或可执行文件?

  13. 13

    生成的安装程序会创建指向错误可执行文件的快捷方式

  14. 14

    包装并使用安装程序后,Windows上的可执行文件未退出

  15. 15

    Eclipse C ++安装程序,未设置可执行文件的路径

  16. 16

    生成的安装程序会创建指向错误可执行文件的快捷方式

  17. 17

    Windows:从Store安装的应用程序的可执行文件在哪里?

  18. 18

    在Debian中安装应用程序/ x可执行文件

  19. 19

    找到新安装的应用程序“Beyond Compare”的可执行文件

  20. 20

    cabal通过沙箱从Hackage安装可执行文件?

  21. 21

    在Cabal中定义未安装的可执行文件

  22. 22

    安装perlbrew:无法检索patchperl可执行文件

  23. 23

    从软件包安装的可执行文件列表

  24. 24

    通过JSPM安装后运行可执行文件

  25. 25

    安装pylint OSX省略可执行文件

  26. 26

    Homebrew在哪里安装Postgres可执行文件?

  27. 27

    使用nsis安装可执行文件的特权

  28. 28

    从软件包安装的可执行文件列表

  29. 29

    安装perlbrew:无法检索patchperl可执行文件

热门标签

归档