Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix 3.11“;此操作仅对当前安装的项目有效;重建项目后_Wix_Windows Installer_Setup Project_Wix3.11 - Fatal编程技术网

Wix 3.11“;此操作仅对当前安装的项目有效;重建项目后

Wix 3.11“;此操作仅对当前安装的项目有效;重建项目后,wix,windows-installer,setup-project,wix3.11,Wix,Windows Installer,Setup Project,Wix3.11,我有一个WiX 3安装项目,使用VS 2017 community with WiX toolset v3.11,使用以下工具安装输出: msiexec/i cient.setup.msi/lv output.log 一切都很好。使用卸载 msiexec/x cient.setup.msi/lv output.log 也可以但是如果我重建WiS安装项目,然后尝试使用上述命令卸载,我会从MSI输出中得到错误1602。即“此操作仅对当前安装的项目有效” 以下是我的Product.wxs文件的内容:

我有一个WiX 3安装项目,使用VS 2017 community with WiX toolset v3.11,使用以下工具安装输出:

msiexec/i cient.setup.msi/lv output.log

一切都很好。使用卸载

msiexec/x cient.setup.msi/lv output.log

也可以但是如果我重建WiS安装项目,然后尝试使用上述命令卸载,我会从MSI输出中得到错误1602。即“此操作仅对当前安装的项目有效”

以下是我的
Product.wxs
文件的内容:

<?xml version="1.0" encoding="UTF-8"?>
<!-- The name of the product -->
<?define Name = "Notification Client" ?>
<!-- The manufacturer, for setup package publisher and folder info -->
<?define Manufacturer = "MyCompanies IT" ?>
<!-- The version number of this setup package-->
<?define Version = "1.0.1" ?>
<!-- UpgradeCode must be unique and not changed once the first version of the program is installed. -->
<?define UpgradeCode = "{GUID-HERE}" ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <?define ClientService_TargetDir=$(var.ClientService.TargetDir)?>
  <Product Id="*" Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" Language="1033" Version="$(var.Version)" UpgradeCode="$(var.UpgradeCode)">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

    <Feature Id="ProductFeature" Title="Client.Setup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentRef Id="ApplicationShortcut" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
          <Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
          <Component Feature="ProductFeature" Id="SetFolderPermissions" Guid="*">
            <CreateFolder>
              <util:PermissionEx User="Users" GenericAll="yes" />
            </CreateFolder>
          </Component>
        </Directory>
      </Directory>
      <Directory Id="StartupFolder" SourceName="Startup"/>
    </Directory>
  </Fragment>

  <Fragment>
    <DirectoryRef Id="StartupFolder">
            <Component Id="ApplicationShortcut" Guid="*">
              <Shortcut Id="StartupShortcut"
                   Directory="StartupFolder"
                   Name="Notification Client"
                   Target="[INSTALLFOLDER]\NotificationClient.exe"
                   WorkingDirectory="INSTALLFOLDER"
           />
              <RemoveFolder Id="CleanUpShortCut" Directory="StartupFolder" On="uninstall"/>
              <RegistryValue Root="HKCU" Key="Software\Microsoft\NotificationClient" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
            </Component>
    </DirectoryRef>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
      <!-- <Component Id="ProductComponent"> -->
      <!-- TODO: Insert files, registry keys, and other resources here. -->
      <!-- </Component> -->
      <Component Id="NotificationClient.exe" Guid="*">
        <File Id="NotificationClient.exe" Name="NotificationClient.exe" Source="$(var.ClientService_TargetDir)NotificationClient.exe" DiskId="1" KeyPath="yes" />
      </Component>
      <Component Id="NotificationClient.exe.config" Guid="*">
        <File Id="NotificationClient.exe.config" Name="NotificationClient.exe.config" Source="$(var.ClientService_TargetDir)NotificationClient.exe.config" KeyPath="no" />
      </Component>
      <Component Id="Newtonsoft.Json.dll" Guid="*">
        <File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="$(var.ClientService_TargetDir)Newtonsoft.Json.dll" KeyPath="no" />
      </Component>
      <Component Id="Notifications.dll" Guid="*">
        <File Id="Notifications.dll" Name="Notifications.dll" Source="$(var.ClientService_TargetDir)Notifications.dll" KeyPath="no" />
      </Component>
      <Component Id="OHR_StdFunctions.dll" Guid="*">
        <File Id="OHR_StdFunctions.dll" Name="OHR_StdFunctions.dll" Source="$(var.ClientService_TargetDir)OHR_StdFunctions.dll" KeyPath="no" />
      </Component>
      <Component Id="OHR_MSGraph.dll" Guid="*">
        <File Id="OHR_MSGraph.dll" Name="OHR_MSGraph.dll" Source="$(var.ClientService_TargetDir)OHR_MSGraph.dll" KeyPath="no" />
      </Component>
      <Component Id="ServiceInstallation" Guid="*">
        <!-- Remove all files from the INSTALLFOLDER on uninstall -->
        <RemoveFile Id="ALLFILES" Name="*.*" On="both" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

我觉得这与GUID问题有关,但我遵循了其他帖子中关于大写GUID的指导原则,每次都重新生成产品Id,以确保升级可以顺利进行


我是Wix的新成员(这是我的第一个项目),所以请友好一点!)

升级代码用于枚举要删除的潜在候选项,以代替挂起的安装。重建时,将重新生成
/Wix/Product[@Id]
,因此这将显示为一个新产品,它可以使用您维护的现有升级代码“升级”任何内容。

您已将产品GUID设置为自动生成(这很好)。这意味着您编译的每个MSI都将有一个新的产品GUID—自然。您可以通过指定的MSI文件或指定要卸载的产品GUID来调用MSI卸载。有关这方面的信息,请参阅此小“参考资料”,您的部分将是第3节(此答案有点长,请只关注第3节)

您正在命令中指定要卸载的MSI文件,该文件不是当前安装在该框中的MSI-因此嵌入在MSI中的产品代码对于当前卸载是错误的(所安装的是以前的版本之一-具有不同的产品GUID)

您可以找到用于在机箱上安装的原始MSI(如果您仍然拥有它),然后您的命令
msiexec/x cient.setup.MSI/lv output.log
将起作用,或者您可以找出已安装产品的产品代码,然后按如下方式卸载:
msiexec/x{product-GUID}/lv output.log
。一旦找到正确的产品GUID,这将始终有效。此卸载从
%SystemRoot%\Installer
(超级隐藏文件夹)中原始MSI的缓存副本运行

以下是查找已安装产品的产品GUID的一种方法:(这个答案也有点长,只需查找PowerShell命令即可


升级:如果不为每个安装创建新的产品GUID,则无法使用主要升级。你得到的是一个小的升级。这必须以与主要升级不同的方式安装。大多数人使用大型升级,因为它们更灵活。您需要实施重大升级,使最新的安装程序在安装时以静默方式卸载现有的安装程序,否则在添加/删除程序中会出现两个条目

正在设置主要升级:


我将添加您建议的链接:。

您只能卸载已安装的版本。如果您使用Product Id=“*”重建项目,它是另一个安装,因此未安装。感谢您的快速响应,我认为情况就是这样,因此我已将ProductID更改为已修复,现在在执行相同的过程时,我遇到了不同的错误。。。“此产品的另一个版本已安装…”这没有意义,因为我现在有了固定的产品ID,我的版本和升级代码仍然相同。这不会是一个问题,但如果将ProductID保持为auto,并且我推出了一个更新,它只会在程序和功能中添加另一个条目,而不是更新现有条目。我理解为什么产品ID不同。我可以四处看看,我发现这篇文章详细介绍了如何在更新之前卸载旧版本,以及不可避免地重建msi包。这解决了我的问题。所以我会把你的回答记为答案。如果你认为我的问题对其他新的Wix用户有用,请更新我的问题:)是的,你的问题的格式很好,但我已经做了一些修改,以消除GUID(否则它们可能被复制,你可能会遇到问题-其他人不应该重复使用GUID)。请始终记住从在线发布的源中删除任何此类“”。此外,请考虑投票所有有帮助的答案。