主要升级无法正常进行以下安装
如果当前PC上安装了以前版本的应用程序,则在主要升级期间将自动卸载旧版本,但由于某种原因未安装新版本。
我需要运行这个新安装两次才能卸载旧版本,然后安装新版本
但是,如果我在旧版本的安装中注释掉自定义操作LaunchApplication,那么将不会出现任何问题,并且将在新安装的一次运行期间卸载旧版本并安装新版本。
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name='Foobar 2.0.0' Id='GUID' UpgradeCode='GUID'
Language='1033' Codepage='1252' Version='2.0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar 2.0.0 Installer"
Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
<Property Id='ApplicationFolderName' Value="Acme" />
<Property Id='WixAppFolder' Value="WixPerUserFolder" />
<Upgrade Id='GUID'>
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
Minimum='0.0.1' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='no' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
Minimum='2.0.0' IncludeMinimum='no' />
</Upgrade>
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Acme's Foobar 2.0.0 Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Acme' Name='Acme'>
<Directory Id='INSTALLDIR' Name='Foobar 2.0.0'>
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id='start.vbs' Guid='GUID'>
<File Id='start.vbs' Name='start.vbs' DiskId='1' Source='start.vbs' KeyPath='yes' >
</File>
</Component>
</DirectoryRef>
<Feature Id='Complete' Title='Foobar 2.0.0' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
<ComponentRef Id='start.vbs' />
</Feature>
</Feature>
<CustomAction Id='AlreadyUpdated' Error='[ProductName] has already been updated to 2.0.0 or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' />
<Property Id="WixShellExecTarget" Value="[#start.vbs]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
<Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom>
<RemoveExistingProducts Before="InstallInitialize" />
<Custom Action="LaunchApplication" After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
</Wix>
此安装或自定义操作可能出现什么问题?
VBS程序是空的。
start.vbs:
Private Function startServerSub()
End Function
startServerSub
在一次运行新应用程序期间,应该更改哪些内容能够卸载以前的版本并安装新版本?
更新
我稍微改变了装置
1. InstallInitialize后将执行RemoveExistingProducts
2.添加SELFFOUND到升级元素。
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name='TestApp 2.0.0' Id='GUID' UpgradeCode='GUID'
Language='1033' Codepage='1252' Version='2.0.0' Manufacturer='TestManufacturer Ltd.'>
<Package Id='*' Keywords='Installer' Description="TestManufacturer's TestApp 2.0.0 Installer"
Comments='TestAppis a registered trademark of TestManufacturer Ltd.' Manufacturer='TestManufacturer Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
<Property Id='ApplicationFolderName' Value="TestManufacturer" />
<Property Id='WixAppFolder' Value="WixPerUserFolder" />
<Upgrade Id='GUID'>
<UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
Minimum='2.0.0' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='yes' />
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
Minimum='0.0.1' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='no' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
Minimum='2.0.0' IncludeMinimum='no' />
</Upgrade>
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="TestManufacturer's TestApp 2.0.0 Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='TestManufacturer' Name='TestManufacturer'>
<Directory Id='INSTALLDIR' Name='TestApp 2.0.0'>
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id='start.vbs' Guid='GUID'>
<File Id='start.vbs' Name='start.vbs' DiskId='1' Source='start.vbs' KeyPath='yes' >
</File>
</Component>
</DirectoryRef>
<Feature Id='Complete' Title='TestApp 2.0.0' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
<ComponentRef Id='start.vbs' />
</Feature>
</Feature>
<CustomAction Id='AlreadyUpdated' Error='[ProductName] has already been updated to 2.0.0 or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' />
<Property Id="WixShellExecTarget" Value="[#start.vbs]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
<Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom>
<RemoveExistingProducts After="InstallInitialize" />
<Custom Action="LaunchApplication" After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
</Wix>
然后我创建了4个安装包:
1.在InstallFinalize之后使用自定义操作LaunchApplication的版本1.0.0
2.没有自定义操作LaunchApplication的版本1.0.0
3.在InstallFinalize之后使用自定义操作LaunchApplication的版本2.0.0
4.没有自定义操作LaunchApplication的2.0.0版。
如果安装了带有自定义操作的1.0.0版,则无法安装任何类型的2.0.0版。
我试图在版本1.0.0之后安装版本2.0.0(没有自定义操作)(使用自定义操作):
=== Verbose logging started: 7/22/2015 18:37:48 Build type: SHIP UNICODE 5.00.7601.00 Calling process: C:\Windows\system32\msiexec.EXE ===
...
Action 18:37:48: FindRelatedProducts. Searching for related applications
Action start 18:37:48: FindRelatedProducts.
FindRelatedProducts: Found application: {GUID of 1.0.0}
MSI (c) (A8:A4) [18:37:48:221]: PROPERTY CHANGE: Adding PREVIOUSFOUND property. Its value is '{GUID of 1.0.0}'.
...
Action start 18:37:48: InstallInitialize.
MSI (s) (F4:0C) [18:37:48:299]: Machine policy value 'AlwaysInstallElevated' is 0
MSI (s) (F4:0C) [18:37:48:299]: User policy value 'AlwaysInstallElevated' is 0
MSI (s) (F4:0C) [18:37:48:299]: BeginTransaction: Locking Server
MSI (s) (F4:0C) [18:37:48:299]: Note: 1: 1715 2: TestApp 2.0.0
MSI (s) (F4:0C) [18:37:48:299]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (F4:0C) [18:37:48:299]: Calling SRSetRestorePoint API. dwRestorePtType: 0, dwEventType: 102, llSequenceNumber: 0, szDescription: "Installed TestApp 2.0.0".
MSI (s) (F4:0C) [18:37:48:299]: The System Restore service is disabled. Returned status: 1058. GetLastError() returned: 1058
MSI (s) (F4:0C) [18:37:48:299]: Server not locked: locking for product {GUID of 2.0.0}
Action ended 18:37:48: InstallInitialize. Return value 1.
MSI (s) (F4:0C) [18:37:48:845]: Doing action: RemoveExistingProducts
MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2205 2: 3: ActionText
Action start 18:37:48: RemoveExistingProducts.
MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2262 2: Error 3: -2147287038
...
Action start 18:37:48: InstallFinalize.
...
MSI (s) (F4:AC) [18:37:48:939]: Verifying accessibility of file: start.vbs
MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2318 2:
MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2318 2:
...
Action ended 18:37:48: InstallFinalize. Return value 1.
MSI (s) (F4:AC) [18:37:48:939]: Doing action: LaunchApplication
MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2205 2: 3: ActionText
Action start 18:37:48: LaunchApplication.
MSI (s) (F4:AC) [18:37:48:939]: Creating MSIHANDLE (9) of type 790542 for thread 8108
MSI (s) (F4:B0) [18:37:48:939]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIECB.tmp, Entrypoint: WixShellExec
MSI (s) (F4:24) [18:37:48:939]: Generating random cookie.
MSI (s) (F4:24) [18:37:48:939]: Created Custom Action Server with PID 8596 (0x2194).
MSI (s) (F4:48) [18:37:48:970]: Running as a service.
MSI (s) (F4:48) [18:37:48:970]: Hello, I'm your 32bit Impersonated custom action server.
MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (10) of type 790541 for thread 1140
MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (11) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:001]: Closing MSIHANDLE (11) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (12) of type 790531 for thread 1140
WixShellExec: Error 0x80070002: ShellExec failed with return code 2
MSI (s) (F4!74) [18:37:49:001]: Closing MSIHANDLE (12) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:017]: Creating MSIHANDLE (13) of type 790531 for thread 1140
WixShellExec: Error 0x80070002: failed to launch target
MSI (s) (F4!74) [18:37:49:017]: Closing MSIHANDLE (13) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:017]: Closing MSIHANDLE (10) of type 790541 for thread 1140
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (F4:B0) [18:37:49:017]: Closing MSIHANDLE (9) of type 790542 for thread 8108
Action ended 18:37:49: LaunchApplication. Return value 3.
Action ended 18:37:49: INSTALL. Return value 3.
...
Property(N): WixShellExecTarget = [#start.vbs]
...
CustomAction returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (F4:0C) [18:37:49:017]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (F4:0C) [18:37:49:017]: Note: 1: 2262 2: Error 3: -2147287038
Action ended 18:37:49: RemoveExistingProducts. Return value 3.
MSI (s) (F4:0C) [18:37:49:017]: User policy value 'DisableRollback' is 0
MSI (s) (F4:0C) [18:37:49:017]: Machine policy value 'DisableRollback' is 0
MSI (s) (F4:0C) [18:37:49:017]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1190565049,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: DialogInfo(Type=1,Argument=TestApp 1.0.0)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (F4:0C) [18:37:49:017]: Executing op: SetTargetFolder(Folder=C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: FileCopy(SourceName=C:\Config.Msi\1bc1cc05.rbf,,DestName=C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\start.vbs,Attributes=40992,FileSize=331,PerTick=0,,VerifyMedia=0,ElevateFlags=1,,,,,,,InstallMode=4194308,,,,,,,)
MSI (s) (F4:0C) [18:37:49:017]: File: C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\start.vbs; To be installed; Won't patch; No existing file
...
MSI (s) (F4:0C) [18:37:49:126]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (F4:0C) [18:37:49:126]: Error in rollback skipped. Return: 5
MSI (s) (F4:0C) [18:37:49:126]: No System Restore sequence number for this installation.
MSI (s) (F4:0C) [18:37:49:126]: Unlocking Server
MSI (s) (F4:0C) [18:37:49:173]: Note: 1: 2205 2: 3: Control
Action ended 18:37:49: INSTALL. Return value 3.
...
MSI (s) (F4:0C) [18:37:49:173]: MainEngineThread is returning 1603
MSI (s) (F4:78) [18:37:49:173]: RESTART MANAGER: Session closed.
MSI (s) (F4:78) [18:37:49:173]: RESTART MANAGER: Session closed.
MSI (s) (F4:78) [18:37:49:173]: No System Restore sequence number for this installation.
MSI (s) (F4:78) [18:37:49:173]: User policy value 'DisableRollback' is 0
MSI (s) (F4:78) [18:37:49:173]: Machine policy value 'DisableRollback' is 0
MSI (s) (F4:78) [18:37:49:173]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (F4:78) [18:37:49:173]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (F4:78) [18:37:49:173]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (F4:78) [18:37:49:189]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (s) (F4:78) [18:37:49:189]: Restoring environment variables
MSI (s) (F4:78) [18:37:49:189]: Destroying RemoteAPI object.
MSI (s) (F4:24) [18:37:49:189]: Custom Action Manager thread ending.
MSI (c) (A8:A4) [18:37:49:189]: Back from server. Return value: 1603
MSI (c) (A8:A4) [18:37:49:189]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (A8:A4) [18:37:49:189]: PROPERTY CHANGE: Deleting SECONDSEQUENCE property. Its current value is '1'.
Action ended 18:37:49: ExecuteAction. Return value 3.
Action ended 18:37:49: INSTALL. Return value 3.
...
=== Logging stopped: 7/22/2015 18:37:49 ===
MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 1708
MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 2262 2: Error 3: -2147287038
MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 2262 2: Error 3: -2147287038
MSI (c) (A8:A4) [18:37:49:189]: Product: TestApp 2.0.0 -- Installation failed.
据我所知,根本原因的问题是我没有使用&#34;未安装且未升级的问题&#34;自定义操作LaunchApplication中的条件。
<Custom Action="LaunchApplication" After="InstallFinalize">NOT Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
在这种情况下,安装新版本期间的安装程序会删除旧版本,然后尝试从旧版本运行自定义操作LaunchApplication,但所有文件都已删除。这就是安装失败的原因
我添加了条件&#34;未安装且未升级产品&#34;启动应用程序,现在可以对我的应用程序进行重大升级
但我不确定我应该使用哪种条件 - &#34;未安装且未升级产品&#34;或&#34;未安装&#34;。
我需要在首次安装和所有主要升级期间运行自定义操作LaunchApplication。
答案 0 :(得分:0)
不确定这是一个答案,但评论太多了。
首先,使用详细日志记录进行升级,使用/ L * vx进行msiexec.exe命令以查看正在进行的操作,因为有许多事情没有用。
您的自定义操作在InstallFinalize之后,这意味着它是在安装完成并提交之后,因此不会导致升级失败。
您的RemoveExistingProducts在InstallInitialize之前。这意味着它位于InstallInitialize开始的安装事务之外。它确实需要在InstallInitialize之后才能包含在转换中,因为它目前独立于您的新产品安装,因此您可以获得删除失败或工作的任何组合,并且您的安装失败或正常工作,您可以最终得到您系统上的一组不确定的产品。没有,不是或其中之一。
什么是SELFFOUND?我希望升级元素可以引用它,但是没有。通常,如果要阻止使用相同版本安装主要升级,则应查看MajorUpgrade元素并将AllowSameVersionUpgrades等属性设置为No.如果SELFFOUND旨在阻止两次安装相同的MSI文件,那么不要打扰因为Windows无论如何都不会让你这样做。
因此,没有足够的信息来了解发生了什么,但CA无法负责。最可能的解释是第一次升级失败 - 它删除旧产品,然后新安装失败,并且因为删除是在事务之外,所以你看到的是删除工作并且安装失败。当你再次安装它是一个新系统,这是主要的区别。检查日志!