如何在不存在 .msi 文件的情况下使用产品 ID guid 使用 msiexec 进行卸载 [英] How to uninstall with msiexec using product id guid without .msi file present

查看:17
本文介绍了如何在不存在 .msi 文件的情况下使用产品 ID guid 使用 msiexec 进行卸载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动卸载使用 WiX 创建的软件包,以便更改已安装的软件堆栈 &无需重新配置整个操作系统.最终我将使用 powershell 脚本来执行此操作,但目前我似乎无法使用 cmd 以交互方式卸载我的测试包.

I'm trying to automate the uninstallation of packages created using WiX for the purposes of changing the installed software stack & configuration without reprovisioning a whole OS. Eventually I'll use powershell scripting to do this but at the moment I can't seem to get my test package to uninstall interactively with cmd.

如果我跑:

msiexec/x '{A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8}'

msiexec/x A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8

我明白了:

无法打开安装包.请确认安装包存在并且您可以访问它,或联系应用程序供应商验证这是一个有效的 Windows 安装程序包."

如果我运行:msiexec/x {A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8}

我明白了:

此操作仅对当前安装的产品有效"

我查看了 windows installer指南WiX 文档、msiexec 文档和使用 orca 来检查 .msi 自己,但我还没有真正找到任何可以清楚地说明如何处理卸载的内容.是否需要 .msi 文件?如果不需要,那么为什么 Windows 安装程序在给定 GUID 时似乎认为它是必需的?

I've looked at the windows installer guide, the WiX documentation, msiexec documentation and used orca to go over the .msi myself but I've not really found anything that gives a clear picture of how an uninstall is processed. Is the .msi file required and if not then why does windows installer seem to think it is when given a GUID?

.msi 安装程序的 WiX 代码是:

The WiX code for the .msi installer is:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='htp://schemas.microsoft.com/wix/2006/wi' >

  <!--DO NOT COPY / PASTE THE PRODUCT ID GUID BELOW TO YOUR OWN WIX SOURCE -->

  <Product Id='A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8' Language='2057' 
           Manufacturer='COMPANYNAME IT-Operations' 
           Name='COMPANYNAMEServerListener' Version='1.0.0' 
           UpgradeCode='PUT-GUID-HERE'>

   <Package Id='*' Manufacturer='COMPANYNAME IT-Operations' Compressed='yes' />
   <Media Id='1' Cabinet='COMPANYNAMEServerListener.cab' EmbedCab='yes' />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
      <Directory Id='COMPANYNAME' Name='COMPANYNAME'>
        <Directory Id='INSTALLDIR' Name='COMPANYNAMEServerListener'>
        <Component Id='MainExecutable' Guid='*' >
          <File Id='COMPANYNAMEServerListener.exe' 
                Source='COMPANYNAMEServerListener.exe' Vital='yes' 
                KeyPath='yes' />
          <ServiceInstall 
            Id='COMPANYNAMEServerListenerInstall'
            DisplayName='COMPANYNAMEServerListener'
            Description='Accepts and discards TCP connections on port 28028 to indicate that this server is alive and ready to be controlled'
            Name='COMPANYNAMEServerListener'
            Account='NT AUTHORITYLocalService'
            ErrorControl='normal'
            Start='auto'
            Type='ownProcess'
            Vital='yes'           
          >
            <ServiceDependency Id='tcpip'/>
          </ServiceInstall>
          <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="COMPANYNAMEServerListener" Wait="yes" />
        </Component>
        </Directory>
        </Directory>
      </Directory>
      </Directory>

    <Feature Id='Complete' Level='1' >
      <ComponentRef Id='MainExecutable' />
    </Feature>

    <CustomTable Id ="COMPANYNAMEMetadata">
      <Column Id="Property" Type="string" Category="Identifier" PrimaryKey="yes"/>
      <Column Id="Value" Type="string"/>
      <Row>
      <Data Column="Property">InstallString</Data>
      <Data Column="Value">/qn</Data>
      </Row>
    </CustomTable>


  </Product>
</Wix>

推荐答案

感谢大家的帮助 - 原来这是一个 WiX 问题.

Thanks all for the help - turns out it was a WiX issue.

当产品 ID GUID 被明确保留时 &与问题中的硬编码一样,当使用 orca 检查时,生成的 .msi 没有 ProductCode 属性,而是一个 Product ID 属性.

When the Product ID GUID was left explicit & hardcoded as in the question, the resulting .msi had no ProductCode property but a Product ID property instead when inspected with orca.

一旦我将 GUID 更改为 '*' 以自动生成,ProductCode 就会出现并且一切正常,其他答案确认了语法.

Once I changed the GUID to '*' to auto-generate, the ProductCode showed up and all works fine with syntax confirmed by the other answers.

这篇关于如何在不存在 .msi 文件的情况下使用产品 ID guid 使用 msiexec 进行卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆