I'm using Wix 3.11.4510.0
During the Install we see the error in the log. It appears to be doing no harm as I don't believe that is actually firing . We are geting calls from customers asking
Thanks
Michae
<ComponentGroup Id="UnInstallCleanUp" Directory="APPLICATIONFOLDER">
<Component Id="UnInstallCleanUp" Guid="{908C5D26-8379-4E62-86F8-26C9F0409EAA}">
<RegistryValue Root="HKLM" Key="Software\xxxxxxxxxsx\PublicReadable" Name="Path" Type="string" Value="[APPLICATIONFOLDER]" KeyPath="yes"/>
<util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
</Component>
</ComponentGroup>
This occurs
Action ended 12:29:39: ValidateProductID. Return value 1.
Action start 12:29:39: WixRemoveFoldersEx.
MSI (s) (38!1C) [12:29:40:112]: Closing MSIHANDLE (7) of type 790531 for thread 5148
MSI (s) (38!1C) [12:29:40:112]: Closing MSIHANDLE (3) of type 790541 for thread 5148
MSI (s) (38!1C) [12:29:40:114]: Closing MSIHANDLE (6) of type 790531 for thread 5148
MSI (s) (38!1C) [12:29:40:114]: Closing MSIHANDLE (5) of type 790540 for thread 5148
WixRemoveFoldersEx: Error 0x80070057: Missing folder property: APPLICATIONFOLDER for row: wrfD426C0E3317774F55FB79E7BF0E43C1F
MSI (s) (38:A8) [12:29:40:116]: Closing MSIHANDLE (2) of type 790542 for thread 8540
CustomAction WixRemoveFoldersEx returned actual error code 1603 but will be translated to success due to continue marking
MSI (s) (38:5C) [12:29:40:117]: Doing action: CostInitialize
MSI (s) (38:5C) [12:29:40:117]: Note: 1: 2205 2: 3: ActionText
Action ended 12:29:40: WixRemoveFoldersEx. Return value 1.
The WixRemoveFoldersEx custom action runs during every operation, to determine if it has work to do. The log message is to indicate that the property isn't set and it couldn't do any work even if there were work to do.
I've added MajorUpgrade element to msi. Increased version, changed UpgradeCode, ProductId is the same. Here what it looks like
<?define Config = "Release" ?>
<?define ProductId = "{87FEDA58-2732-4BBA-9C1E-B7A9AE1A46F6}" ?>
<?define UpgradeCode = "{B414C827-8D81-4B4A-B3B6-338C06DE3A11}" ?>
<?define ProductName = "Some Product" ?>
<?define Version = "2.0.0.0" ?>
<?define Company = "Some Inc." ?>
<?define Description = "Installs Some Product" ?>
In version 1.0.0.0 ProductId is different. MajorUpgrade is set like this
<MajorUpgrade
Schedule="afterInstallValidate"
DowngradeErrorMessage="A newer version of [ProductName] is already installed."
AllowSameVersionUpgrades="yes" />
During the upgrade it successfully identifies previous version on FindRelatedProducts stage
Action start 22:31:06: FindRelatedProducts.
MSI (s) (38:78) [22:31:06:557]: PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'.
MSI (s) (38:78) [22:31:06:557]: PROPERTY CHANGE: Adding MIGRATE property. Its value is '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'.
MSI (s) (38:78) [22:31:06:557]: Doing action: AppSearch
MSI (s) (38:78) [22:31:06:557]: Note: 1: 2205 2: 3: ActionText
Action ended 22:31:06: FindRelatedProducts. Return value 1.
RemoveExistingProducts starts the uninstallation RemoveFolderEx removes some folders and RemoveExistingProducts stage returns code 1 (success right?). But it doesn't remove entries in registry. Product is still there. Components not remove. Here is the log.
Action start 22:35:25: RemoveExistingProducts.
MSI (s) (38:78) [22:35:25:190]: Note: 1: 2205 2: 3: Error
MSI (s) (38:78) [22:35:25:190]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 23
MSI (s) (38:AC) [22:35:25:190]: Resetting cached policy values
MSI (s) (38:AC) [22:35:25:190]: Machine policy value 'Debug' is 0
MSI (s) (38:AC) [22:35:25:190]: ******* RunEngine:
******* Product: {3E786878-358D-43AD-82D1-1435ADF9F6EA}
******* Action:
******* CommandLine: **********
MSI (s) (38:AC) [22:35:25:205]: Note: 1: 2265 2: 3: -2147287035
MSI (s) (38:AC) [22:35:25:205]: End dialog not enabled
MSI (s) (38:AC) [22:35:25:205]: Original package ==> C:\Windows\Installer\bd684.msi
MSI (s) (38:AC) [22:35:25:205]: Package we're running from ==> C:\Windows\Installer\bd684.msi
MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: Uninstall Flags override found.
MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: Uninstall VersionNT override found.
MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: Uninstall ServicePackLevel override found.
MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: looking for appcompat database entry with ProductCode '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'.
MSI (s) (38:AC) [22:35:25:221]: APPCOMPAT: no matching ProductCode found in database.
MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'DisablePatch' is 0
MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'AllowLockdownPatch' is 0
MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'DisableLUAPatching' is 0
MSI (s) (38:AC) [22:35:25:221]: Machine policy value 'DisableFlyWeightPatching' is 0
MSI (s) (38:AC) [22:35:25:237]: APPCOMPAT: looking for appcompat database entry with ProductCode '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'.
MSI (s) (38:AC) [22:35:25:237]: APPCOMPAT: no matching ProductCode found in database.
MSI (s) (38:AC) [22:35:25:237]: Transforms are not secure.
MSI (s) (38:AC) [22:35:25:237]: Command Line: UPGRADINGPRODUCTCODE={87FEDA58-2732-4BBA-9C1E-B7A9AE1A46F6} CLIENTPROCESSID=2520 CLIENTUILEVEL=3 MSICLIENTUSESEXTERNALUI=1 REMOVE=ALL
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{0C30C985-B880-4BEF-90B5-52ED8736B108}'.
MSI (s) (38:AC) [22:35:25:237]: Product Code passed to Engine.Initialize: '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'
MSI (s) (38:AC) [22:35:25:237]: Product Code from property table before transforms: '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'
MSI (s) (38:AC) [22:35:25:237]: Product Code from property table after transforms: '{3E786878-358D-43AD-82D1-1435ADF9F6EA}'
MSI (s) (38:AC) [22:35:25:237]: Product registered: entering maintenance mode
MSI (s) (38:AC) [22:35:25:237]: Determined that existing product (either this product or the product being upgraded with a patch) is installed per-machine.
MSI (s) (38:AC) [22:35:25:237]: MSI_LUA: Nested installation UAC elevation tracks that of parent (is not elevated)
MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is admin assigned: LocalSystem owns the publish key.
MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is managed.
MSI (s) (38:AC) [22:35:25:237]: MSI_LUA: Credential prompt not required, user is an admin
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding ProductState property. Its value is '5'.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'.
MSI (s) (38:AC) [22:35:25:237]: Package name retrieved from configuration data: 'aep_monolith.msi'
MSI (s) (38:AC) [22:35:25:237]: Note: 1: 2205 2: 3: Error
MSI (s) (38:AC) [22:35:25:237]: Note: 1: 2262 2: AdminProperties 3: -2147287038
MSI (s) (38:AC) [22:35:25:237]: Machine policy value 'DisableMsi' is 1
MSI (s) (38:AC) [22:35:25:237]: Machine policy value 'AlwaysInstallElevated' is 0
MSI (s) (38:AC) [22:35:25:237]: User policy value 'AlwaysInstallElevated' is 0
MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is admin assigned: LocalSystem owns the publish key.
MSI (s) (38:AC) [22:35:25:237]: Product {3E786878-358D-43AD-82D1-1435ADF9F6EA} is managed.
MSI (s) (38:AC) [22:35:25:237]: Running product '{3E786878-358D-43AD-82D1-1435ADF9F6EA}' with elevated privileges: Product is assigned.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding UPGRADINGPRODUCTCODE property. Its value is '{87FEDA58-2732-4BBA-9C1E-B7A9AE1A46F6}'.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding CLIENTPROCESSID property. Its value is '2520'.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding CLIENTUILEVEL property. Its value is '3'.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding MSICLIENTUSESEXTERNALUI property. Its value is '1'.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding REMOVE property. Its value is 'ALL'.
MSI (s) (38:AC) [22:35:25:237]: Machine policy value 'DisableAutomaticApplicationShutdown' is 0
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding MsiRestartManagerSessionKey property. Its value is '7dad24bc7ce3134db335b2318702e12c'.
MSI (s) (38:AC) [22:35:25:237]: RESTART MANAGER: Session opened.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding MsiSystemRebootPending property. Its value is '1'.
MSI (s) (38:AC) [22:35:25:237]: TRANSFORMS property is now:
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding PRODUCTLANGUAGE property. Its value is '1033'.
MSI (s) (38:AC) [22:35:25:237]: PROPERTY CHANGE: Adding VersionDatabase property. Its value is '301'.
Here is the ending of it
MSI (s) (38:78) [22:39:08:694]: Note: 1: 2205 2: 3: Error
MSI (s) (38:78) [22:39:08:694]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 16
MSI (s) (38:78) [22:39:08:694]: Note: 1: 2205 2: 3: Error
MSI (s) (38:78) [22:39:08:694]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 21
MSI (s) (38:78) [22:39:08:694]: Doing action: ProcessComponents
MSI (s) (38:78) [22:39:08:694]: Note: 1: 2205 2: 3: ActionText
Action ended 22:39:08: RemoveExistingProducts. Return value 1.
And at the very end I get
MSI (s) (38:78) [22:42:18:570]: Windows Installer installed the product. Product Name: Some Product. Product Version: 2.0.0.0. Product Language: 1033. Manufacturer: Some Inc.. Installation success or error status: 0.
Could you help me please? I ran out of any ideas.
The easiest way to author a major upgrade is to not author as many GUIDs as possible. See this example. Don't even author component GUIDs if you don't have to, i.e. if they contain more than one resource - but try to avoid that.
For example, this makes an easy major upgrade:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Sample Product" Language="1033" Version="1.0.0.0" Manufacturer="Heath Stewart" UpgradeCode="f10d913e-7669-4962-aa3f-963425ecf10b">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SampleProduct" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SampleProduct" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component>
<File Source="$(var.SampleApp.TargetPath)" />
</Component>
<Component>
<RegistryKey Root="HKLM" Key="Software\[Manufacturer]\[ProductName]">
<RegistryValue Name="InstallDir" Type="string" Value="[INSTALLFOLDER]" />
<RegistryValue Name="Version" Type="string" Value="[ProductVersion]" KeyPath="yes" />
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Notice that Product/#Id="*" is authored, and there's no package ID. There are really no good reasons to hardcode them, nor should you. Only the Product/#UpgradeCode should be hardcoded, and only if the root install folder is the same. You don't want to change the folder when the component GUIDs remain the same, of vice versa. It creates all sorts of shared component issues, which I've blogged a lot about in the past: https://devblogs.microsoft.com/setup/tag/shared-components/
I need to create installer which creates new local user, new folder and gives full permissions to this user.
I created small test below using new wix project via Visual Studio 2010 and Wix 3.10:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="DG" UpgradeCode="85e3204f-c872-4229-bb75-fa5231863a75">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Feature Id='TestUserProductFeature' Title='Test User Product Feature' Level='1'>
<ComponentRef Id='TestUserProductComponent' />
</Feature>
<InstallExecuteSequence>
<Custom Action='ConfigureUsers' Before='CreateFolders'/>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Id='TestUserProductComponent' Guid='652C2BE1-9DE7-47AD-A686-55ABAAF68B6F'>
<util:User Id='TEST_USER1' Name='testName1' Password='pa$$$$word' CreateUser='yes' FailIfExists='yes'/>
</Component>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject1" >
<Directory Id="d_TestDirectory" Name="TestDirectory">
<Component Id="CreateTestDirectory" Guid="8B7EB548-5767-7017-A56C-4EEBDDF7B621">
<CreateFolder Directory="d_TestDirectory">
<Permission User="testName1" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<ComponentRef Id="CreateTestDirectory"/>
</ComponentGroup>
</Fragment>
</Wix>
Please note I added
<Custom Action='ConfigureUsers' Before='CreateFolders'/>
To create user before creating of new folder.
Also please note I added
FailIfExists='yes'
for util:User so it will fail if user exists.
When I run my msi with logging, I get this message first:
An error occured while applying security settings. testName1 is not a vaild user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install.
This means that my user was not created.
Then I create local user myself manually and press Retry.
Then I get this error:
Failed to create user (-2147022672 testName1 )
It means that installer cannot create user because it's already created(FailIfExists='yes')
This is my InstallExecuteSequence from Orca:
FindRelatedProducts 25
LaunchConditions 100
ValidateProductID 700
CostInitialize 800
FileCost 900
CostFinalize 1000
MigrateFeatureStates 1200
InstallValidate 1400
RemoveExistingProducts 1401
InstallInitialize 1500
ProcessComponents 1600
UnpublishFeatures 1800
RemoveFolders 3600
ConfigureUsers 3699
CreateFolders 3700
RegisterUser 6000
RegisterProduct 6100
PublishFeatures 6300
PublishProduct 6400
InstallFinalize 6600
This is a part of my log file with actions logging:
Action start 0:02:47: RemoveFolders.
Action ended 0:02:47: RemoveFolders. Return value 1.
MSI (s) (D8:88) [00:02:47:389]: Doing action: ConfigureUsers
MSI (s) (D8:88) [00:02:47:389]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: ConfigureUsers.
MSI (s) (D8:28) [00:02:47:391]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIDFFA.tmp, Entrypoint: ConfigureUsers
MSI (s) (D8:48) [00:02:47:391]: Generating random cookie.
MSI (s) (D8:48) [00:02:47:392]: Created Custom Action Server with PID 1440 (0x5A0).
MSI (s) (D8:E4) [00:02:47:409]: Running as a service.
MSI (s) (D8:E4) [00:02:47:410]: Hello, I'm your 32bit Impersonated custom action server.
MSI (s) (D8!30) [00:02:47:475]: PROPERTY CHANGE: Adding CreateUserRollback property. Its value is '**********'.
MSI (s) (D8!30) [00:02:47:476]: Doing action: CreateUserRollback
MSI (s) (D8!30) [00:02:47:476]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: CreateUserRollback.
Action ended 0:02:47: CreateUserRollback. Return value 1.
MSI (s) (D8!30) [00:02:47:477]: PROPERTY CHANGE: Adding CreateUser property. Its value is '**********'.
MSI (s) (D8!30) [00:02:47:478]: Doing action: CreateUser
MSI (s) (D8!30) [00:02:47:478]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: CreateUser.
Action ended 0:02:47: CreateUser. Return value 1.
Action ended 0:02:47: ConfigureUsers. Return value 1.
MSI (s) (D8:88) [00:02:47:481]: Doing action: CreateFolders
MSI (s) (D8:88) [00:02:47:481]: Note: 1: 2205 2: 3: ActionText
Action start 0:02:47: CreateFolders.
MSI (s) (D8:88) [00:02:47:481]: Note: 1: 1609 2: testName1 3: 1332
MSI (c) (B4:B8) [00:02:47:483]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1609. An error occurred while applying security settings. testName1 is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install. Unable to locate the user's SID, system error 1332
MSI (s) (D8:88) [00:03:14:513]:
MSI (s) (D8:88) [00:03:14:513]: Note: 1: 1609 2: testName1 3: 1332
MSI (c) (B4:B8) [00:03:14:515]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1609. An error occurred while applying security settings. testName1 is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click Retry, or Cancel to end the install. Unable to locate the user's SID, system error 1332
MSI (s) (D8:88) [00:03:31:485]:
MSI (s) (D8:88) [00:03:31:486]: Finished allocating new user SID
MSI (s) (D8:88) [00:03:31:486]: Using well known SID for System
MSI (s) (D8:88) [00:03:31:486]: Finished allocating new user SID
Action ended 0:03:31: CreateFolders. Return value 1.
MSI (s) (D8:88) [00:03:31:486]: Doing action: RegisterUser
MSI (s) (D8:88) [00:03:31:486]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: RegisterUser.
Action ended 0:03:31: RegisterUser. Return value 1.
MSI (s) (D8:88) [00:03:31:487]: Doing action: RegisterProduct
MSI (s) (D8:88) [00:03:31:487]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: RegisterProduct.
MSI (s) (D8:88) [00:03:31:487]: Note: 1: 2262 2: Media 3: -2147287038
MSI (s) (D8:88) [00:03:31:488]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'.
Action ended 0:03:31: RegisterProduct. Return value 1.
MSI (s) (D8:88) [00:03:31:488]: Doing action: PublishFeatures
MSI (s) (D8:88) [00:03:31:488]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: PublishFeatures.
Action ended 0:03:31: PublishFeatures. Return value 1.
MSI (s) (D8:88) [00:03:31:489]: Doing action: PublishProduct
MSI (s) (D8:88) [00:03:31:489]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: PublishProduct.
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2205 2: 3: Icon
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2228 2: 3: Icon 4: SELECT `Name`, `Data` FROM `Icon`
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2262 2: Media 3: -2147287038
Action ended 0:03:31: PublishProduct. Return value 1.
MSI (s) (D8:88) [00:03:31:490]: Doing action: InstallFinalize
MSI (s) (D8:88) [00:03:31:490]: Note: 1: 2205 2: 3: ActionText
Action start 0:03:31: InstallFinalize.
MSI (s) (D8:88) [00:03:31:491]: Running Script: C:\Windows\Installer\MSIDFE9.tmp
MSI (s) (D8:88) [00:03:31:491]: PROPERTY CHANGE: Adding UpdateStarted property. Its value is '1'.
MSI (s) (D8:88) [00:03:31:491]: Machine policy value 'DisableRollback' is 0
MSI (s) (D8:88) [00:03:31:493]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (D8:88) [00:03:31:494]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1216610392,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (D8:88) [00:03:31:494]: Executing op: ProductInfo(ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},ProductName=SetupProject1,PackageName=SetupProject1.msi,Language=1033,Version=16777216,Assignment=1,ObsoleteArg=0,,,PackageCode={413012CF-A56C-4342-9DE3-50774CA5DD67},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=2)
MSI (s) (D8:88) [00:03:31:494]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (D8:88) [00:03:31:494]: Executing op: DialogInfo(Type=1,Argument=SetupProject1)
MSI (s) (D8:88) [00:03:31:495]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (D8:88) [00:03:31:495]: Executing op: SetBaseline(Baseline=0,)
MSI (s) (D8:88) [00:03:31:495]: Executing op: SetBaseline(Baseline=1,)
MSI (s) (D8:88) [00:03:31:495]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (D8:88) [00:03:31:495]: Executing op: ProgressTotal(Total=2,Type=1,ByteEquivalent=24000)
MSI (s) (D8:88) [00:03:31:495]: Executing op: ComponentRegister(ComponentId={652C2BE1-9DE7-47AD-A686-55ABAAF68B6F},KeyPath=C:\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
MSI (s) (D8:88) [00:03:31:496]: Executing op: ComponentRegister(ComponentId={8B7EB548-5767-7017-A56C-4EEBDDF7B621},KeyPath=C:\Program Files (x86)\SetupProject1\TestDirectory\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
MSI (s) (D8:88) [00:03:31:496]: Executing op: ActionStart(Name=CreateUserRollback,,)
MSI (s) (D8:88) [00:03:31:496]: Executing op: CustomActionSchedule(Action=CreateUserRollback,ActionType=11521,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (D8:88) [00:03:31:497]: Executing op: ActionStart(Name=CreateUser,,)
MSI (s) (D8:88) [00:03:31:497]: Executing op: CustomActionSchedule(Action=CreateUser,ActionType=11265,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (D8:64) [00:03:31:498]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI8C49.tmp, Entrypoint: CreateUser
MSI (s) (D8:48) [00:03:31:498]: Generating random cookie.
MSI (s) (D8:48) [00:03:31:499]: Created Custom Action Server with PID 2476 (0x9AC).
MSI (s) (D8:E4) [00:03:31:517]: Running as a service.
MSI (s) (D8:E4) [00:03:31:517]: Hello, I'm your 32bit Elevated custom action server.
CreateUser: Error 0x800708b0: failed to create user: testName1
MSI (c) (B4:B8) [00:03:31:600]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 26401. Failed to create user. (-2147022672 testName1 )
MSI (s) (D8!58) [00:04:07:562]: Product: SetupProject1 -- Error 26401. Failed to create user. (-2147022672 testName1 )
CustomAction CreateUser returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 0:04:07: InstallFinalize. Return value 3.
MSI (s) (D8:88) [00:04:07:566]: User policy value 'DisableRollback' is 0
MSI (s) (D8:88) [00:04:07:566]: Machine policy value 'DisableRollback' is 0
MSI (s) (D8:88) [00:04:07:567]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1216610416,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (D8:88) [00:04:07:567]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (D8:88) [00:04:07:567]: Executing op: DialogInfo(Type=1,Argument=SetupProject1)
MSI (s) (D8:88) [00:04:07:568]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (D8:88) [00:04:07:569]: Executing op: ActionStart(Name=CreateUser,,)
MSI (s) (D8:88) [00:04:07:569]: Executing op: ProductInfo(ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},ProductName=SetupProject1,PackageName=SetupProject1.msi,Language=1033,Version=16777216,Assignment=1,ObsoleteArg=0,,,PackageCode={413012CF-A56C-4342-9DE3-50774CA5DD67},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=2)
MSI (s) (D8:88) [00:04:07:569]: Executing op: ActionStart(Name=CreateUserRollback,,)
MSI (s) (D8:88) [00:04:07:569]: Executing op: CustomActionRollback(Action=CreateUserRollback,ActionType=11521,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (D8:C8) [00:04:07:571]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI1929.tmp, Entrypoint: RemoveUser
MSI (s) (D8:88) [00:04:07:950]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (D8:88) [00:04:07:950]: Executing op: ComponentUnregister(ComponentId={8B7EB548-5767-7017-A56C-4EEBDDF7B621},ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},BinaryType=0,)
MSI (s) (D8:88) [00:04:07:950]: Executing op: ComponentUnregister(ComponentId={652C2BE1-9DE7-47AD-A686-55ABAAF68B6F},ProductKey={718267EA-D291-4ED2-8BA6-F3B872BEA874},BinaryType=0,)
MSI (s) (D8:88) [00:04:07:950]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (D8:88) [00:04:07:950]: Error in rollback skipped. Return: 5
MSI (s) (D8:88) [00:04:07:953]: Note: 1: 2318 2:
MSI (s) (D8:88) [00:04:07:953]: Calling SRSetRestorePoint API. dwRestorePtType: 13, dwEventType: 103, llSequenceNumber: 38, szDescription: "".
MSI (s) (D8:88) [00:04:07:954]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (D8:88) [00:04:07:954]: Unlocking Server
MSI (s) (D8:88) [00:04:08:135]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 0:04:08: INSTALL. Return value 3.
So, it seems like CreateUser is actually run as elevated (deffered) custom action from another temp dll during InstallFinalize action.
Even if ConfigureUsers is said to run before CreateFolders, it just plans elevated custom action.
Is my scenario possible to be achieved? What is wrong?
It's not clear what you're doing with immediate custom actions - they are never supposed to alter the system because there is no way to undo them. All custom actions that alter the system need to be deferred so that they a) Roll back with a rollback CA and b) run elevated because immediate CAs are not elevated. If some CAs depend on others just order them appropriately.
That CreateUser error 0x8007089a means "The specified username is invalid.". If that trace code that shows "vmtest\user" is correct, maybe that's incorrect. Why the backslash? Is the "user" part a password? Also I don't believe that the trace would reveal a password, so maybe the user name is "vmtest\user" and that backslash is invalid as part of a user name.
Major upgrade does not work correctly for following installation.
If the previous version of the application is installed on the current PC, then during major upgrade old version will be automatically uninstalled, but new version is not installed by some reason.
I need to run this new installation twice in order to uninstall the old version and then install new one.
But if I comment out the custom action LaunchApplication in the old version of installation, then there will not be any problems and old version will be uninstalled and new version will be installed during the one run of the new installation.
<?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>
What could be wrong with this installation or with custom action?
VBS procedure is empty.
start.vbs:
Private Function startServerSub()
End Function
startServerSub
What should be changed to have ability to uninstall previous version and install new one during one run of new application?
UPDATE:
I changed my installation a little.
1. RemoveExistingProducts will be executed after InstallInitialize.
2. Added SELFFOUND to Upgrade element.
<?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>
Then I created 4 installation packages:
1. Version 1.0.0 with custom action LaunchApplication after InstallFinalize.
2. Version 1.0.0 without custom action LaunchApplication.
3. Version 2.0.0 with custom action LaunchApplication after InstallFinalize.
4. Version 2.0.0 without custom action LaunchApplication.
It is impossible to install any type of version 2.0.0, if version 1.0.0 with custom action was installed.
I tried to install version 2.0.0(without custom action) after version 1.0.0(with custom action):
=== 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.
As I understand the root cause problem is that I do not use "NOT Installed AND NOT UPGRADINGPRODUCTCODE" condition in custom action LaunchApplication.
<Custom Action="LaunchApplication" After="InstallFinalize">NOT Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
In this case installer during installation of new version removes the old version, and then tries to run custom action LaunchApplication from the old version, but all files are already removed. That's why installation fails.
I added condition "NOT Installed AND NOT UPGRADINGPRODUCTCODE" to LaunchApplication and now it is possible to perform major upgrade of my application.
But I am not sure which condition should I use - "NOT Installed AND NOT UPGRADINGPRODUCTCODE" or "NOT Installed".
I need to run custom action LaunchApplication during first installation and during all major upgrades.
Not sure this is an answer but there's too much for a comment.
First, do the upgrades with verbose logging, msiexec.exe command with a /L*vx to see what's going on because there are a number of things that don't make sense.
Your custom action is after InstallFinalize, which means it is after the install has completed and committed so it cannot cause the the upgrade to fail.
Your RemoveExistingProducts is before InstallInitialize. This means that it is outside the install transaction that starts at InstallInitialize. It really needs to be just after InstallInitialize to be included in the transation because currently it is independent of your new product install, and so you can get any combination of the remove failing or working and your install failing or working and you can end up with an indeterminate set of products on your system. None, noth or one of them.
What's SELFFOUND? I'd expect an Upgrade element to refer to it but there isn't one. In general you should look at the MajorUpgrade element and set attributes such as AllowSameVersionUpgrades to No if you want to prevent installing a major upgrade with the same version. If SELFFOUND is intended to prevent installing the same MSI file twice, then don't bother because Windows won't let you do that anyway.
So there's not really enough info to see what's going on, but that CA can't be responsible. The most likely explanation is that the first upgrade fails - it removes the older product, then your new install fails, and because the remove is outside the transaction all you see is the remove working and your install failing. When you install again it's a fresh system, that's the main difference. Check the logs!
This is my .wxs file
Particularly I managed to install a service as a LocalSystem user, and started it:
<!-- Directory where [prey]/versions/[version] will be -->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Prey">
<Directory Id="VersionsDir" Name="versions">
<Directory Id="VersionDir" Name="$(var.ProductVersion)">
<Directory Id="BinDir" Name="bin">
<Directory Id="BinWindowsDir" Name="windows">
<Component Id="CronServiceExe"
Guid="ECC25B2A-FB2E-425A-92AD-DCF1D34204FF">
<File Id="file_8FF048AD40124B9F9C07126F2C14A765"
Checksum="yes"
KeyPath="yes"
Source="source-msi\versions\0.10.0\bin\windows\cronsvc.exe" />
<ServiceInstall Id="CronServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="CronService"
DisplayName="Cron Service"
Start="auto"
Account="LocalSystem"
ErrorControl="normal"
Interactive="no">
</ServiceInstall>
<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="CronService"
Wait="yes" />
</Component>
<Component Id="CronServiceDll"
Guid="75C4129B-C28A-45A8-9F06-CB496259FE7F">
<File Id="file_11D016207EA34826A20A52524A3A82BC"
Checksum="yes"
KeyPath="yes"
Source="source-msi\versions\0.10.0\bin\windows\Cronsvclib.dll" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
And it runs fine. Everything is OK, except when I get to uninstall the product. Because despite being asked in an UAC dialog I get (Screenshot), the installer insist that I don't have permissions to stop the service.
Here is the screenshot of the Error, which says:
Service 'Cron Service' (CronService) could not be stopped. Verify that you have sufficient privileges to stop system services.
And, here is the specific logs (I'm uninstalling with /L*v option to get verbose logs). You can get the full file in this gist.
Lines 2220 - 2226
MSI (s) (90:80) [19:11:54:953]: Note: 1: 2205 2: 3: Icon
MSI (s) (90:80) [19:11:54:953]: Note: 1: 2205 2: 3: TypeLib
MSI (s) (90:80) [19:11:54:953]: Note: 1: 2727 2:
MSI (s) (90:80) [19:11:54:973]: RESTART MANAGER: Detected that the service CronService will be stopped due to a service control action authored in the package before the files are updated. So, we will not attempt to stop this service using Restart Manager
MSI (s) (90:80) [19:11:54:973]: Note: 1: 2727 2:
MSI (s) (90:80) [19:11:54:973]: Doing action: InstallInitialize
MSI (s) (90:80) [19:11:54:973]: Note: 1: 2205 2: 3: ActionText
Action ended 19:11:54: InstallValidate. Return value 1.
Lines 4624 - 4635
MSI (s) (90:80) [19:11:57:196]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1])
MSI (s) (90:80) [19:11:57:196]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (90:80) [19:11:57:196]: Executing op: ServiceControl(,Name=CronService,Action=2,Wait=1,)
MSI (s) (90:80) [19:12:27:239]: Note: 1: 2205 2: 3: Error
MSI (s) (90:80) [19:12:27:239]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1921
MSI (s) (90:80) [19:16:38:940]: Note: 1: 2205 2: 3: Error
MSI (s) (90:80) [19:16:38:940]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709
MSI (s) (90:80) [19:16:38:940]: Product: Prey Anti-theft -- Error 1921. Service 'Cron Service' (CronService) could not be stopped. Verify that you have sufficient privileges to stop system services.
MSI (s) (90:80) [19:17:08:983]: Note: 1: 2205 2: 3: Error
MSI (s) (90:80) [19:17:08:983]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1921
MSI (c) (48:84) [19:12:27:239]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Given all that information. I infere that somewhere I have to manage to start my MSI as an administrator. Or not?
That's my problem:
Is there a way to set up my .msi installer as an "admin only" one? (If that choice does exist).
The weird thing is that all posts and google results I'm getting are about problems INSTALLING and STARTING the service, rather than STOPPING it. So I'm in a dead end.
Please, all help will be very useful and appreciated.
The error message includes the suggestion that it's a permissions problem. That's rarely the case, since installing services requires elevated permissions to begin with. Failure to stop a service is usually as simple as the service not responding to the stop request quickly enough. Does CronService implement the service interface to respond to stop requests? Neither MSI nor Windows will kill a service process to stop it.