【发布时间】:2014-02-24 19:55:26
【问题描述】:
我正在尝试自动卸载使用 WiX 创建的软件包,以便在不重新配置整个操作系统的情况下更改已安装的软件堆栈和配置。最终我将使用 powershell 脚本来执行此操作,但目前我似乎无法让我的测试包与 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 guide、WiX documentation、msiexec 文档并使用 orca 自己检查了 .msi,但我还没有真正找到任何可以清楚地了解卸载是如何处理的。是否需要 .msi 文件?如果不需要,为什么 Windows 安装程序在给定 GUID 时会认为它是必需的?
.msi 安装程序的 WiX 代码是:
<?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 AUTHORITY\LocalService'
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>
【问题讨论】:
-
在引用 ID 时必须使用大括号是 100% 正确的。我没有大量使用 WiX 的经验,但我的印象是您所做的事情是正确的。如果您打开命令提示符并键入 rundll32 dfshim CleanOnlineAppCache 并重试,会发生什么?
-
有关执行此操作的不同方法的一长串列表,请查看Uninstalling an MSI file from the command line without using msiexec
标签: wix installation uninstallation windows-installer