How to uninstall a service completely from an application in the next upgrade which isn't a major upgrade - wix

I am trying to uninstall an installed service that has several components but not able to.
Could anyone please help me with the uninstalling tags too? I did a lot of searches but couldn't run anything successfully.
Just putting ServiceControl tag and removing all the components work? I tried that but didn't work. How do you deal with components and dependencies? Need logic and syntax help.
Below is my code that installs the service in the previous version. Please let me know of the tags that I have to add to remove this.
<Directory Id="dirxxx" Name="oldname">
<!-- oldname service-->
<Component Id="cmpOldNameService" Guid="bbb"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no"
Win64="no" Location="either">
<RemoveFile Id="ccc" On="uninstall" Name="z.dll"/>
<File Id="ccc" KeyPath="no" Source="$(var.xSource)\OldNameService\a.dll"/>
<File Id="ddd" KeyPath="no" Source="$(var.xSource)\OldNameService\b.dll"/>
<File Id="eee" KeyPath="no" Source="$(var.xSource)\OldNameService\c.dll"/>
<File Id="fff" KeyPath="no" Source="$(var.xSource)\OldNameService\d.dll"/>
<File Id="ggg" KeyPath="no" Source="$(var.xSource)\OldNameService\e.dll"/>
<File Id="hhh" KeyPath="no" Source="$(var.xSource)\OldNameService\f.dll"/>
<File Id="iii" KeyPath="yes" Source="$(var.xSource)\OldNameService\g.exe"/>
<File Id="jjj" KeyPath="no" Source="$(var.xSource)\OldNameService\h.dll"/>
<File Id="kkk" KeyPath="no" Source="$(var.xSource)\OldNameService\i.dll"/>
<ServiceInstall Id="OldNameService" DisplayName="OldName Service" Name="NewName"
ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" Description="OldName Service">
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes"/>
</ServiceInstall>
<ServiceControl Id="OldNameServiceControl" Name="NewName"
Start="install" Stop="uninstall" Remove="uninstall" Wait="no"/>
</Component>
<Component Id="lll" Guid="mmm" NeverOverwrite="yes">
<File Id="nnn" KeyPath="yes" Source="$(var.xSource)\OldNameService\OldName.exe.config"/>
<util:XmlFile Id="UpdateOldNamelogFileName"
File="[#nnn]"
Action="setValue"
ElementPath="/configuration/appSettings/add[\[]#key='logFile'[\]]/#value"
Value="[ooo]oldname_YYYYMM.log" />
</Component>
<!--Recovery-Interval needs to be added in both cases new install as well as upgrades-->
<Component Id="qqq" Guid="r-r-r-r-r" NeverOverwrite="yes">
<Condition><![CDATA[INSTALDIR <> "" AND NOT REMOVE AND POSTV1 = ""]]></Condition>
<CreateFolder />
<util:XmlConfig Id="RecoveryInterval" Action="create" ElementPath="config/settings" File="[INSTALDIR]\oldname\OldNameService.exe.config" Node="element" On="install" Name="add" Sequence="1">
<util:XmlConfig Id="RecoveryInterval2" ElementId="RecoveryInterval" Name="key" Value="Recovery-Interval" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
<util:XmlConfig Id="RecoveryInterval3" ElementId="RecoveryInterval" Name="value" Value="3600" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
</util:XmlConfig>
</Component>
<!-- Analytics-->
<Component Id="eee" Guid="f-f-f-f-f" NeverOverwrite="yes">
<Condition><![CDATA[(INSTALDIR <> "") AND NOT REMOVE]]></Condition>
<CreateFolder />
<!-- Analytics-->
<util:XmlConfig Id="EnableAnalytics" Action="create" ElementPath="config/settings" File="[INSTALDIR]\oldname\OldNameService.exe.config" Node="element" On="install" Name="add" VerifyPath="/config/settings/add[\[]#key='EnableAnalytics'[\]]">
<util:XmlConfig Id="EnableAnalytics2" ElementId="EnableAnalytics" Name="key" Value="VEnableAnalytics" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
<util:XmlConfig Id="EnableAnalytics3" ElementId="EnableAnalytics" Name="value" Value="1" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
</util:XmlConfig>
<util:XmlConfig Id="AnalyticsTrackingId" Action="create" ElementPath="config/settings" File="[INSTALDIR]\oldname\OldNameService.exe.config" Node="element" On="install" Name="add" VerifyPath="/config/settings/add[\[]#key='AnalyticsTrackingId'[\]]">
<util:XmlConfig Id="AnalyticsTrackingId2" ElementId="AnalyticsTrackingId" Name="key" Value="AnalyticsTrackingId" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
<util:XmlConfig Id="AnalyticsTrackingId3" ElementId="AnalyticsTrackingId" Name="value" Value="YwByAE3eVweXAAcAVwBasBUAAgAMsB0AAwAbzz==" File="[INSTALDIR]\oldname\OldNameService.exe.config" />
</util:XmlConfig>
</Component>
<!-- Added to handle upgrade scenario for assembly binding redirect for Newtonsoft.json -->
<Component Id="cmpNewtonsoftVersionUpgrade" Guid="{a-60CA-d-w-f}" NeverOverwrite="yes">
<Condition><![CDATA[(INSTALDIR <> "") AND NOT REMOVE]]></Condition>
<CreateFolder/>
<util:XmlConfig Id="AddRuntimeElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="runtime" On="install"
ElementPath="configuration"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]#name='Newtonsoft.Json'[\]]"
Sequence="1" />
<util:XmlConfig Id="AddAssemblyBindingElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="assemblyBinding" On="install" ElementPath="configuration/runtime"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]#name='Newtonsoft.Json'[\]]"
Sequence="2"/>
<util:XmlConfig Id="AddDependentAssemblyElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="dependentAssembly" On="install"
ElementPath="configuration/runtime/assemblyBinding"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]#name='Newtonsoft.Json'[\]]"
Sequence="3"/>
<util:XmlConfig Id="AddAssemblyIdentityElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="assemblyIdentity" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/assemblyIdentity[\[]#name='Newtonsoft.Json'[\]]"
Sequence="4">
<util:XmlConfig Id="AddNameKey"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="name" Value="Newtonsoft.Json" />
<util:XmlConfig Id="AddPublicKeyToken"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="publicKeyToken" Value="30ad4fe6b2a6aeed" />
<util:XmlConfig Id="AddCulture"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="culture" Value="neutral" />
<util:XmlConfig Id="AddXmlnsOnAssemblyIdentity"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddAssemblyIdentityElement" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" />
</util:XmlConfig>
<util:XmlConfig Id="DeleteBindingRedirectElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="delete" Node="element" Name="bindingRedirect" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]#name='Newtonsoft.Json'[\]][\]]"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/bindingRedirect[\[]#oldVersion='0.0.0.0-6.0.0.0'[\]]"
Sequence="5" />
<util:XmlConfig Id="DeleteBindingRedirectElementoldserviceOnv4"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="delete" Node="element" Name="bindingRedirect" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]#name='Newtonsoft.Json'[\]][\]]"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/bindingRedirect[\[]#oldVersion='0.0.0.0-8.0.0.0'[\]]"
Sequence="6" />
<util:XmlConfig Id="AddBindingRedirectElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="element" Name="bindingRedirect" On="install"
ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]#name='Newtonsoft.Json'[\]][\]]"
VerifyPath="/configuration/runtime/assemblyBinding/dependentAssembly/bindingRedirect[\[]#oldVersion='0.0.0.0-9.0.0.0'[\]]"
Sequence="7">
<util:XmlConfig Id="AddOldVersionKey"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddBindingRedirectElement" Name="oldVersion" Value="0.0.0.0-9.0.0.0" />
<util:XmlConfig Id="AddNewVersionKeyS3Uploader"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddBindingRedirectElement" Name="newVersion" Value="9.0.0.0" />
<util:XmlConfig Id="AddXmlnsOnBindingRedirectS3Uploader"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
ElementId="AddBindingRedirectElement" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" />
</util:XmlConfig>
<util:XmlConfig Id="AddNameSpaceToyElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="value" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" On="install"
ElementPath="/configuration/runtime/assemblyBinding"
Sequence="8" />
<util:XmlConfig Id="AddNameSpaceToDependentAssemblyElement"
File="[INSTALDIR]\oldname\OldNameService.exe.config"
Action="create" Node="value" Name="xmlns" Value="urn:schemas-microsoft-com:asm.v1" On="install"
ElementPath="/configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity[\[]#name='Newtonsoft.Json'[\]][\]]"
Sequence="9" />
</Component>
</Directory>
EXAMPLE TRIAL FOR 1 COMPONENT:
<Component Id="cmpoldNameService" Guid="9-kj-4509-ko-B4F7700AFDCE"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="yes"
Win64="no" Location="either">
<Condition>FALSE</Condition>
<RemoveFolder Id="diytg" On="uninstall"/>
<RemoveFile Id="ghgj" On="uninstall" Name="a.dll"/>
<RemoveFile Id="uiu" On="uninstall" Name="b.dll"/>
<RemoveFile Id="hujhjn" On="uninstall" Name="c.dll"/>
<RemoveFile Id="okl" On="uninstall" Name="d.dll"/>
<RemoveFile Id="bbb" On="uninstall" Name="e.dll"/>
<RemoveFile Id="bbbb" On="uninstall" Name="f.dll"/>
<RemoveFile Id="kkkl" On="uninstall" Name="g.dll"/>
<RemoveFile Id="mmmm" On="uninstall" Name="h.dll"/>
<RemoveFile Id="nnn" On="uninstall" Name="i.exe"/>
<RemoveFile Id="bboo" On="uninstall" Name="j.dll"/>
<RemoveFile Id="ttt" On="uninstall" Name="k.dll"/>
<ServiceControl Id="OldNameServiceControl" Name="OldName"
Start="install" Stop="both" Remove="both" Wait="yes"/>
</Component>

MSI Minor Upgrades can't officially remove components or features. The workaround (Hack) is to keep the original components but supply them a zero byte file and set the Revaluate attribute (transitive bit in MSI) to true and give it a condition that will always evaluate to false. This way the Windows Installer transitions this component to not installed and the service is stopped and removed.
You'll have to keep this 0 byte fake component around until you do your next major upgrade. Then it can be removed.
To be honest, Minor Upgrades are very picky and if you don't already know these rules you might be better served by always doing major upgrades until you do. Minor upgrades can push you into a corner really hard if you let it.

Related

WIX install windows service with x64

I had to change my project to x64 and now following this tutorial I try to change my WIX installation to x64 also. But the WIX installation tries to install a windows service. This service throws the following exception in install.log with msiexec /i Setup.msi /L*V install.log:
System.Reflection.TargetInvocationException: A call target caused an exception. ---> System.BadImageFormatException: The file or Assembly "Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" or a dependency on it was not found. An attempt was made to load a file with the wrong format.
at SaveServiceConfigurationAction.CustomActions.SaveServiceConfiguration(Session session)
--- End of internal exception batch monitoring ---
bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction SaveServiceConfigurationAction returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
When I try to install this service with installutil.exe I get a similar exception
System.BadImageFormatException: The file or assembly "Service.exe" or a dependency on it was not found. An attempt was made to load a file with the wrong format.
But if I use Framework64\v4.0.30319\installutil.exe the service could be installed with no problem.
So now my question: How do I configure my WIX project to use Framework64 to install the service?
My WIX-Code:
<Component Id="CMP_Service" Feature="Core">
<File Source="$(var.Service.TargetPath)" KeyPath="yes">
<fire:FirewallException Id="ServiceException" Name="Service Exception" Protocol="tcp" Port="[PORTProperty]" Scope="any" />
</File>
<ServiceInstall Id="ServiceInstallELS"
Name="Service"
Description="..."
Start="auto"
Account="[SERVICEACCOUNT]"
ErrorControl="normal"
Type="ownProcess"
Vital="no" />
<ServiceControl Id="ServiceControllELS"
Name="Service"
Start="install"
Stop="both"
Remove="uninstall"
Wait="no" />
</Component>
Please check this.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define DemoMarketingContacts.UI_TargetDir=$(var.DemoMarketingContacts.UI.TargetDir)?>
<?define DemoMarketingContacts.UploaderUI_TargetDir=$(var.DemoMarketingContacts.UploaderUI.TargetDir)?>
<?define DemoMarketingContacts.ValidatorUI_TargetDir=$(var.DemoMarketingContacts.ValidatorUI.TargetDir)?>
<?define DemoMarketingContacts.Domain_TargetDir=$(var.DemoMarketingContacts.Domain.TargetDir)?>
<?define QueryStringUtilies_TargetDir=$(var.QueryStringUtilies.TargetDir)?>
<?define Demo.InternetCheckerService_TargetDir=$(var.Demo.InternetCheckerService.TargetDir)?>
<?define Demo.InternetChecker.Server_TargetDir=$(var.Demo.InternetChecker.Server.TargetDir)?>
<Product Id="50D6E335-B3EF-44EE-B3AE-899B260F8FBF" Name="Demo Marketing Contacts" Language="1033" Version="4.0.0.0"
Manufacturer="Demo Technologies (pvt)Ltd." UpgradeCode="495757a4-415c-4dbe-81fb-a6fa78c40a5b">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Icon Id="EmailMarketing.ico" SourceFile="$(var.ProjectDir)Email Marketing.ico" />
<Icon Id="UploadEmail.ico" SourceFile="$(var.ProjectDir)UploadEmail.ico" />
<Icon Id="ValidEmail.ico" SourceFile="$(var.ProjectDir)ValidEmail.ico" />
<Property Id="AppIcon" Value="Email Marketing" />
<Property Id="ARPPRODUCTICON" Value="EmailMarketing.ico" />
<!--<UIRef Id="WixUI_Minimal" />-->
<UIRef Id="DemoSetUpUI" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="DemoMarketing Contacts" Level="1" TypicalDefault="install">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentRef Id="AuditLogFolderComponent" />
<ComponentRef Id="LogFolderComponent" />
</Feature>
<Feature Id="ValidatorFeature" Title="DemoMarketing Contacts Validator" Level="1" TypicalDefault="install">
<ComponentGroupRef Id="ValidatorUIComponents" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
</Feature>
<Feature Id="InternetCheckerServiceFeature" Title="Demo Internet Checker" Level="2" Description="This is the Demo Internet Checker Service component" TypicalDefault="advertise">
<ComponentGroupRef Id="ServiceComponetGroup" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Demo Marketing Contacts">
<Directory Id="AuditLogFolder" Name="AuditLog" />
<Directory Id="LogFolder" Name="Log" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="DemoMarketing Contacts" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="A65731C2-FDFB-4C41-BD8B-8AD5E2E441B2">
<Shortcut Id="UploaderStartMenuShortcut" Name="DemoMarketing Contacts Uploader" Description="DemoMarketing Contacts Uploader" Target="[#DemoMarketingContacts.UploaderUI.exe]" WorkingDirectory="INSTALLFOLDER" />
<Shortcut Id="ValidatorStartMenuShortcut" Name="DemoMarketing Contacts Validator" Description="DemoMarketing Contacts Validator" Target="[#DemoMarketingContacts.ValidatorUI.exe]" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\DemoMarketing Contacts" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="6F764DEA-E1DE-418E-9B5C-4E09E6C5FB3E">
<Shortcut Id="UploaderDesktopShortcut" Name="DemoMarketing Contacts Uploader" Description="DemoMarketing Contacts Uploader" Target="[#DemoMarketingContacts.UploaderUI.exe]" WorkingDirectory="INSTALLFOLDER" />
<Shortcut Id="ValidatorDesktopShortcut" Name="DemoMarketing Contacts Validator" Description="DemoMarketing Contacts Validator" Target="[#DemoMarketingContacts.ValidatorUI.exe]" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\DemoMarketing Contacts" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="AuditLogFolder">
<Component Id="AuditLogFolderComponent" Guid="49FE9EB9-90A5-46D6-93FD-45FA153F53D5" KeyPath="yes">
<CreateFolder />
</Component>
</DirectoryRef>
<DirectoryRef Id="LogFolder">
<Component Id="LogFolderComponent" Guid="B7CFA16B-B755-42F5-B9FE-AC161F758D53" KeyPath="yes">
<CreateFolder />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="DemoMarketingContacts.UploaderUI.exe" Guid="25B57A38-AD92-430E-96C0-887F7826E69E">
<File Id="DemoMarketingContacts.UploaderUI.exe" Name="DemoMarketingContacts.UploaderUI.exe" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)DemoMarketingContacts.UploaderUI.exe" />
</Component>
<Component Id="DemoMarketingContacts.UploaderUI.exe.config" Guid="0DD136DB-D607-42F1-9FB6-24200E43AA80">
<File Id="DemoMarketingContacts.UploaderUI.exe.config" Name="DemoMarketingContacts.UploaderUI.exe.config" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)DemoMarketingContacts.UploaderUI.exe.config" />
</Component>
<Component Id="MySql.Data.dll" Guid="1cd1c916-b9cc-451d-be2f-c17bec362710">
<File Id="MySql.Data.dll" Name="MySql.Data.dll" Source="$(var.DemoMarketingContacts.UI_TargetDir)MySql.Data.dll" />
</Component>
<Component Id="DbManagerLibrary.dll" Guid="8307fa02-f630-4f0b-9ca1-77784fcc716b">
<File Id="DbManagerLibrary.dll" Name="DbManagerLibrary.dll" Source="$(var.DemoMarketingContacts.UI_TargetDir)DbManagerLibrary.dll" />
</Component>
<Component Id="Md5CryptoEngine.dll" Guid="0baf14db-3d30-4f20-913d-9bba02357d63">
<File Id="Md5CryptoEngine.dll" Name="Md5CryptoEngine.dll" Source="$(var.DemoMarketingContacts.UI_TargetDir)Md5CryptoEngine.dll" />
</Component>
<Component Id="QueryStringUtilies.dll" Guid="fdf2e586-a590-4ca8-bd4b-ef0fcafcd8e5">
<File Id="QueryStringUtilies.dll" Name="QueryStringUtilies.dll" Source="$(var.QueryStringUtilies_TargetDir)QueryStringUtilies.dll" />
</Component>
<Component Id="DemoMarketingContacts.Domain.dll" Guid="719641ed-d882-412f-a826-ebded804de08">
<File Id="DemoMarketingContacts.Domain.dll" Name="DemoMarketingContacts.Domain.dll" Source="$(var.DemoMarketingContacts.Domain_TargetDir)DemoMarketingContacts.Domain.dll" />
</Component>
<Component Id="Conf.sys" Guid="8f8f0b68-8a2f-4e6e-81b8-296b6d1e3038">
<File Id="Conf.sys" Name="Conf.sys" Source="$(var.DemoMarketingContacts.UI_TargetDir)Conf.sys" />
</Component>
<Component Id="LicenseKey.sys" Guid="b5478971-d1d6-4d6c-b254-ded5d8658ef7">
<File Id="LicenseKey.sys" Name="LicenseKey.sys" Source="$(var.DemoMarketingContacts.UI_TargetDir)LicenseKey.sys" />
</Component>
<Component Id="System.Windows.Interactivity.dll" Guid="1d71080d-a57b-47b9-9cbf-64f430252846">
<File Id="System.Windows.Interactivity.dll" Name="System.Windows.Interactivity.dll" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)System.Windows.Interactivity.dll" />
</Component>
<Component Id="Caliburn.Micro.Platform.Core.dll" Guid="54fd8728-8a96-4d6e-bc14-2df25a47fbe5">
<File Id="Caliburn.Micro.Platform.Core.dll" Name="Caliburn.Micro.Platform.Core.dll" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)Caliburn.Micro.Platform.Core.dll" />
</Component>
<Component Id="Cobisi.EmailVerify.Net45.dll" Guid="feb50857-53b2-4c14-904e-2f86f25fa4d8">
<File Id="Cobisi.EmailVerify.Net45.dll" Name="Cobisi.EmailVerify.Net45.dll" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)Cobisi.EmailVerify.Net45.dll" />
</Component>
<Component Id="Caliburn.Micro.Platform.dll" Guid="c85997a8-0571-4a34-83cc-a12022f17ff7">
<File Id="Caliburn.Micro.Platform.dll" Name="Caliburn.Micro.Platform.dll" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)Caliburn.Micro.Platform.dll" />
</Component>
<Component Id="Caliburn.Micro.dll" Guid="50795ece-887e-43bf-811f-29806c37ea5b">
<File Id="Caliburn.Micro.dll" Name="Caliburn.Micro.dll" Source="$(var.DemoMarketingContacts.UploaderUI_TargetDir)Caliburn.Micro.dll" />
</Component>
<Component Id="Demo.InternetCheckerService.exe.config" Guid="c60abb1b-7f57-4056-86a6-23aa7cf936db">
<File Id="Demo.InternetCheckerService.exe.config" Name="Demo.InternetCheckerService.exe.config" Source="$(var.Demo.InternetCheckerService_TargetDir)Demo.InternetCheckerService.exe.config" />
</Component>
<Component Id="Email_Marketing.ico" Guid="bbb37327-15e9-44ab-9816-c0bfe09a7895">
<File Id="Email_Marketing.ico" Name="Email Marketing.ico" Source="$(var.DemoMarketingContacts.UI_TargetDir)Email Marketing.ico" />
</Component>
<Component Id="Read_me.txt" Guid="31685dd1-c56f-4c70-89a9-f2327d143f17">
<File Id="Read_me.txt" Name="Read me.txt" Source="$(var.DemoMarketingContacts.UI_TargetDir)Read me.txt" />
</Component>
</ComponentGroup>
<ComponentGroup Id="ValidatorUIComponents" Directory="INSTALLFOLDER">
<Component Id="DemoMarketingContacts.ValidatorUI.exe" Guid="8672B6FC-6419-495D-A9C3-F3977F8B7B8F">
<File Id="DemoMarketingContacts.ValidatorUI.exe" Name="DemoMarketingContacts.ValidatorUI.exe" Source="$(var.DemoMarketingContacts.ValidatorUI_TargetDir)DemoMarketingContacts.ValidatorUI.exe" />
</Component>
<Component Id="DemoMarketingContacts.ValidatorUI.exe.config" Guid="28572FF1-B8D8-42DF-86C8-041FFBA9EA31">
<File Id="DemoMarketingContacts.ValidatorUI.exe.config" Name="DemoMarketingContacts.ValidatorUI.exe.config" Source="$(var.DemoMarketingContacts.ValidatorUI_TargetDir)DemoMarketingContacts.ValidatorUI.exe.config" />
</Component>
</ComponentGroup>
<ComponentGroup Id="ServiceComponetGroup" Directory="INSTALLFOLDER">
<Component Id="ServiceComponent" Guid="28ABD97D-3091-485D-AF21-0BD96151D52B" DiskId="1" SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no" Win64="no" Location="either">
<File Id="Demo.InternetChecker.Server.dll" Name="Demo.InternetChecker.Server.dll" Source="$(var.Demo.InternetChecker.Server_TargetDir)Demo.InternetChecker.Server.dll" KeyPath="no" />
<File Id="Demo.InternetCheckerService.exe" Name="Demo.InternetCheckerService.exe" Source="$(var.Demo.InternetCheckerService_TargetDir)Demo.InternetCheckerService.exe" ReadOnly="no" Compressed="yes" KeyPath="yes" Vital="yes" Hidden="no" System="no" Checksum="no" />
<ServiceInstall Id="DemoInternetCheckerServiceInstall" DisplayName="Demo Internet Checker Service Instance" Description="This Service is broadcast internet availability to the intranet." Name="DemoInternetCheckerExeName" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
<ServiceControl Id="DemoInternetCheckerServiceControl" Name="DemoInternetCheckerExeName" Start="install" Stop="uninstall" Remove="uninstall" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

Wix Toolset. Unable to Delete Registry Keys on Uninstall

I wrote an Installer with Wix. Everything works but I can't delete Registry Keys on Uninstall; the log says
Disallowing uninstallation of component: {...} since another client
exists
. The code is
<ComponentGroup Id="RegistryGroup">
<Component Id="_FB6B829B_467B_4EB8_B90C_9FF64097AD38" Guid="3FBC3951-B566-4EB9-842C-9FB70A8ECDE6" Transitive="no" Directory="TARGETDIR">
<RegistryKey Root="HKCU" Key="Software" ForceCreateOnInstall="no" ForceDeleteOnUninstall="no" />
</Component>
<Component Id="_F47C127C_2EAC_4F0C_B742_03FFBCABE8AE" Guid="A5D5FF6A-1EEA-4941-9DC5-573FDCB595A5" Transitive="no" Directory="TARGETDIR">
<RegistryKey Root="HKCU" Key="Software\[Manufacturer]" ForceCreateOnInstall="no" ForceDeleteOnUninstall="yes" />
</Component>
<Component Id="_684BCAC8_3162_4C7C_93A3_908CA1485F5C" Guid="92BF7699-68B1-44EE-BDE8-AF7E7CEB0EB0" Transitive="no" Directory="TARGETDIR">
<RegistryKey Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" ForceCreateOnInstall="no" ForceDeleteOnUninstall="yes" />
</Component>
<Component Id="_FC3941D7_6617_4313_8257_5C3DE03A9838" Guid="7DCD2392-AC9A-4690-BC99-FEACAA774B08" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="ProductName" Value="[ProductName]" />
</Component>
<Component Id="_B86DABB3_7467_428B_9ECF_A6F59DB594E4" Guid="7A61E342-9764-4AA4-86A9-87C7A9C1DB09" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="ProductCode" Value="[ProductCode]" />
</Component>
<Component Id="_201EDD75_B6C7_4873_8AF9_06230F421B4F" Guid="52AE095B-FDEE-4923-B78A-F314BC26C6B6" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="Company" Value="[Manufacturer]" />
</Component>
<Component Id="_B76910AF_8752_45C2_98BF_80724406E3F9" Guid="81B183E7-67CA-4EF6-848E-55F8299B0A5C" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="ProductVersion" Value="[ProductVersion]" />
</Component>
<Component Id="_9BF1C162_A7A6_4B43_9D7C_6BD85C6C4F27" Guid="A571BA72-2216-49F0-AC28-E72C0866E9A3" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="Location" Value="[TARGETDIR]" />
</Component>
<Component Id="_B140E686_B49A_4BE4_93B3_DEEB07E5218E" Guid="F8996C3A-48EA-40DD-818B-5DC095B5F46F" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="Author" Value="[ARPCONTACT]" />
</Component>
<Component Id="_801F11AF_23B6_4C63_AEE7_05EB877E6543" Guid="0EC7189F-95BE-411E-BE48-A469032923F4" Transitive="no" Directory="TARGETDIR">
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Name="Website" Value="[ARPHELPLINK]" />
</Component>
</ComponentGroup>
What's wrong?
You have two or more installs with components that share the same GUIDs. You probably have authored upgrades of your install incorrectly in some way so every time you tested your installation you were adding more references to the GUIDs tied to these registry keys. You may also have more than one installation on your machine of your product.
You should have a bunch of registry entries under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\S-1-5-18\Components{GUID} Note that the GUID is going to be a different format due to endianness (I think) May help
I would suggest testing your installer in a clean environment preferably on a VM with a clean snapshot you can revert to in case you author a broken installer and are unable to install/uninstall/upgrade the installer and get your machine into a bad state.

Wix service not listed in the local services

I used procrun to create a windows service and tried to install it using WIX. I have placed all the required registry keys at the relevant places. But the service is still not listed in the local services. Below is my code.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="DummyInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Bryan" UpgradeCode="94D1BC64-7CC1-45DA-BD5F-8ED40980E75C">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<Property Id="JAVA_CURRENT_VERSION64">
<RegistrySearch Id="JRE_CURRENT_VERSION_REGSEARCH64" Root="HKLM" Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="CurrentVersion" Type="raw" Win64="yes" />
</Property>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="DummyInstaller" Level="1" >
<!--<ComponentGroupRef Id="NewFilesGroup" />-->
<ComponentRef Id="REGISTRY_A" />
<ComponentRef Id="PROCRUN.EXE"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles">
<Directory Id="DummyDir" Name="DummyInstaller">
<!--<Directory Id="MyProgramDir" Name="MosquittoNew" />-->
<Directory Id="SERVERDIR" Name="Kube2UpdaterService">
<Component Id="REGISTRY_A" DiskId="1" Guid="*" Win64="no">
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Java" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Classpath" Value="E:\Service\Update_Service-1.0.jar" KeyPath="yes" />
<RegistryValue Type="string" Name="Jvm" Value="C:\Program Files\Java\jdk1.8.0_25\jre\bin\server\jvm.dll" />
<RegistryValue Type="multiString" Action="append" Name="Options">
<MultiStringValue Type="multiString" Name="Options" Action="append">-Duser.language=en</MultiStringValue>
<MultiStringValue Type="multiString" Name="Options" Action="append">-Duser.region=US</MultiStringValue>
</RegistryValue>
<RegistryValue Type="integer" Name="JvmMs" Value="256" />
<RegistryValue Type="integer" Name="JvmMx" Value="1024" />
<RegistryValue Type="integer" Name="JvmSs" Value="4000" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Log" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Path" Value="c:\logs" />
<RegistryValue Type="string" Name="Level" Value="Error" />
<RegistryValue Type="string" Name="Prefix" Value="Kube2UpdaterService" />
<RegistryValue Type="string" Name="StdError" Value="c:\logs\stderr.txt" />
<RegistryValue Type="string" Name="StdOutput" Value="c:\logs\stdout.txt" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Start" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Mode" Value="jvm" />
<RegistryValue Type="string" Name="Class" Value="com.kohls.kube.services.updater.UpdaterServiceMain" />
<RegistryValue Type="string" Name="Params" Value="start" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Stop" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Mode" Value="jvm" />
<RegistryValue Type="string" Name="Class" Value="com.kohls.kube.services.updater.UpdaterServiceMain" />
<RegistryValue Type="string" Name="Method" Value="stop" />
<RegistryValue Type="string" Name="Params" Value="stop" />
<RegistryValue Type="string" Name="StdOutput" Value="auto" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Kube2UpdaterService" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Description" Value="Kube updater service performing updates and installation" />
<RegistryValue Type="string" Name="DisplayName" Value="Kube2UpdaterService" />
<RegistryValue Type="string" Name="ImagePath" Value="E:\Service\prunsrv.exe //RS//Kube2UpdaterService" />
<RegistryValue Type="string" Name="DependsOnService" Value="Tcpip Afd" />
<RegistryValue Type="string" Name="ObjectName" Value="LocalSystem" />
<RegistryValue Type="integer" Name="ErrorControl" Value="1" />
<RegistryValue Type="integer" Name="Start" Value="2" />
<RegistryValue Type="integer" Name="Type" Value="16" />
</RegistryKey>
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Kube2UpdaterService\Parameters" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Test" Value="Pass" />
</RegistryKey>
</Component>
<Component Id="PROCRUN.EXE" DiskId="1" Guid="468C2DB3-F722-4DE6-8A91-B6FB8009757D" Win64="no">
<!-- this is the renamed procrun 64 bit executable -->
<File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" />
<ServiceInstall Id="PROCRUN" Type="ownProcess" Name="Kube2UpdaterService" DisplayName="Kube2UpdaterService" Description="Kube 2.0 Updater Service" Start="auto" Account="LocalService" ErrorControl="normal" Arguments=" //RS//Kube2UpdaterService" />
<ServiceControl Id="StartPRUNSRV" Start="install" Stop="both" Remove="uninstall" Name="Kube2UpdaterService" Wait="no" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
</Wix>
What am I doing wrong here? Please advice.
All registry keys under HKLM\SYSTEM\CurrentControlSet\Services are considered internal to Windows. The supported way in MSI to configure Windows Services is to use the Service* tables, like ServiceInstall.
Your:
<File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" />
needs to set be
<File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" Keypath="yes" />
I don't know why, but it helps

Replacing unversioned files in WiX major upgrade

Okay, further examination and experimentation is showing that the problematic file, the pathwaysMdf file, IS being installed! However, after being installed, it's being REMOVED, by a RemoveFiles action!
I imagine it's doing this because that file is part of the original install, so it's doing it's job uninstalling and cleaning up. ARGH! What can I do?!
I am still having this problem. This is the closest I have come to a solution that works, and yet it doesn't quite work. Here is (most of) the code:
<Product Id='$(var.ProductCode)'
UpgradeCode='$(var.UpgradeCode)'
Name="Pathways"
Version='$(var.ProductVersion)'
Manufacturer='$(var.Manufacturer)'
Language='1033'>
<Package Id="*"
Description="Pathways Directory Software"
InstallerVersion="301"
Compressed="yes" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<Media Id="1" Cabinet="Pathways.cab" EmbedCab="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion
OnlyDetect="no"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="OLDAPPFOUND"
/>
<UpgradeVersion
Minimum="$(var.ProductVersion)"
IncludeMinimum="yes"
OnlyDetect="yes"
Language="1033"
Property="NEWAPPFOUND"
/>
</Upgrade>
<!-- directories -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- program files directory -->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Pathways"/>
</Directory>
<!-- application data directory -->
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="CommonAppDataPathways" Name="Pathways" />
</Directory>
<!-- start menu program directory -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramsMenuPathwaysFolder" Name="Pathways" />
</Directory>
<!-- desktop directory -->
<Directory Id="DesktopFolder" />
</Directory>
<Icon Id="PathwaysIcon" SourceFile="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" />
<!-- components in the reference to the install directory -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="Application" Guid="EEE4EB55-A515-4872-A4A5-06D6AB4A06A6">
<File Id="pathwaysExe" Name="Pathways.exe" DiskId="1" Source="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" Vital="yes" KeyPath="yes" Assembly=".net" AssemblyApplication="pathwaysExe" AssemblyManifest="pathwaysExe" />
<File Id="pathwaysChm" Name="Pathways.chm" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Pathways.chm" />
<File Id="publicKeyXml" ShortName="RSAPUBLI.XML" Name="RSAPublicKey.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\RSAPublicKey.xml" Vital="yes" />
<File Id="staticListsXml" ShortName="STATICLI.XML" Name="StaticLists.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\StaticLists.xml" Vital="yes" />
<File Id="axInteropMapPointDll" ShortName="AXMPOINT.DLL" Name="AxInterop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\AxInterop.MapPoint.dll" Vital="yes" />
<File Id="interopMapPointDll" ShortName="INMPOINT.DLL" Name="Interop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
<File Id="mapPointDll" ShortName="MAPPOINT.DLL" Name="MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
<File Id="devExpressData63Dll" ShortName="DAAT63.DLL" Name="DevExpress.Data.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Data.v6.3.dll" Vital="yes" />
<File Id="devExpressUtils63Dll" ShortName="UTILS63.DLL" Name="DevExpress.Utils.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Utils.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraBars63Dll" ShortName="BARS63.DLL" Name="DevExpress.XtraBars.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraBars.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraNavBar63Dll" ShortName="NAVBAR63.DLL" Name="DevExpress.XtraNavBar.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraNavBar.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraCharts63Dll" ShortName="CHARTS63.DLL" Name="DevExpress.XtraCharts.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraCharts.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraEditors63Dll" ShortName="EDITOR63.DLL" Name="DevExpress.XtraEditors.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraEditors.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraPrinting63Dll" ShortName="PRINT63.DLL" Name="DevExpress.XtraPrinting.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraPrinting.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraReports63Dll" ShortName="REPORT63.DLL" Name="DevExpress.XtraReports.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraReports.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraRichTextEdit63Dll" ShortName="RICHTE63.DLL" Name="DevExpress.XtraRichTextEdit.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraRichTextEdit.v6.3.dll" Vital="yes" />
<RegistryValue Id="PathwaysInstallDir" Root="HKLM" Key="Software\Tribal Data Resources\Pathways" Name="InstallDir" Action="write" Type="string" Value="[INSTALLDIR]" />
</Component>
</DirectoryRef>
<!-- application data components -->
<DirectoryRef Id="CommonAppDataPathways">
<Component Id="CommonAppDataPathwaysFolderComponent" Guid="087C6F14-E87E-4B57-A7FA-C03FC8488E0D">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
<RemoveFolder Id="CommonAppDataPathways" On="uninstall" />
<!-- <RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes" />-->
</Component>
<Component Id="Settings" Guid="A3513208-4F12-4496-B609-197812B4A953" NeverOverwrite="yes">
<File Id="settingsXml" KeyPath="yes" ShortName="SETTINGS.XML" Name="Settings.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Settings\settings.xml" Vital="yes" />
</Component>
<Component Id="Database" Guid="1D8756EF-FD6C-49BC-8400-299492E8C65D">
<!--<RegistryValue Root="HKLM" Key="Software\TDR\Pathways\Database" Name="installed" Type="integer" Value="1" KeyPath="yes" />-->
<File Id="pathwaysMdf" CompanionFile="pathwaysExe" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" Vital="yes"/>
<File Id="pathwaysLdf" CompanionFile="pathwaysExe" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf" Vital="yes"/>
</Component>
</DirectoryRef>
<!-- shortcut components -->
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcutComponent" Guid="1BF412BA-9C6B-460D-80ED-8388AC66703F">
<Shortcut Id="DesktopShortcut"
Target="[INSTALLDIR]Pathways.exe"
Name="Pathways"
Description="Pathways Tribal Directory"
Icon="PathwaysIcon"
Show="normal"
WorkingDirectory="INSTALLDIR" />
<RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id ="ProgramsMenuPathwaysFolder">
<Component Id="ProgramsMenuShortcutComponent" Guid="83A18245-4C22-4CDC-94E0-B480F80A407D">
<Shortcut Id="ProgramsMenuShortcut" Target="[INSTALLDIR]Pathways.exe" Name="Pathways" Icon="PathwaysIcon" Show="normal" WorkingDirectory="INSTALLDIR" />
<RemoveFolder Id="ProgramsMenuPathwaysFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="App" Title="Pathways Application" Level="1" Description="Pathways software" Display="expand" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="Application" />
<ComponentRef Id="CommonAppDataPathwaysFolderComponent" />
<ComponentRef Id="Settings"/>
<ComponentRef Id="ProgramsMenuShortcutComponent" />
<Feature Id="Shortcuts" Title="Desktop Shortcut" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="DesktopShortcutComponent" />
</Feature>
</Feature>
<Feature Id="Data" Title="Database" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="Database" />
<!--<ComponentRef Id="MDF"/>
<ComponentRef Id="LDF"/>-->
</Feature>
<UIRef Id ="WixUI_FeatureTree"/>
<UIRef Id="WixUI_ErrorProgressText"/>
<UI>
<Error Id="2000">There is a later version of this program installed.</Error>
</UI>
<CustomAction Id="NewerVersionDetected" Error="2000" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
The problem I am having is that I need the two files in the Database component to replace the previous copies. Since these files are unversioned, I have attempted to use the CompanionFile tag set to the PathwaysExe since that is the main executable of the application, and it IS being updated, even if the log says it isn't! The strangest thing about this is that the PathwaysLdf file IS BEING UPDATED CORRECTLY, and the PathwaysMdf file IS NOT. The log seems to indicate that the "Existing file is of an equal version (Checked using version of companion)". This is very strange because that file is being replaced just fine.
The only idea I have left is that this problem has to do with the install sequence, and I'm not sure how to proceed! I have the InstallExecuteSequence set like I do because of the SettingsXml file, and my need to NOT overwrite that file, which is actually working now, so whatever solution works for the database files can't break the working settings file!
The full log is located at:
http://pastebin.com/HFiGKuKN
Try early scheduling of RemoveExistingProducts, instead of late scheduling and you should be OK.
<RemoveExistingProducts After="InstallInitialize" />

WiX major upgrade refuses to replace existing file!

EDIT!
It's rough how a question on here seems to get seen when first posted, but when a question is asked, and then answered, for me it seems abandoned. I am still having this problem, and not sure what to do.
Hello! I have inherited this project with a WiX installer, and am required to make this version usefully upgrade the previous one! My problem comes in replacing the database files with new versions. No, the problem is not that they are locked, I can replace them manually, and in fact now ONE of them is replaced, while the other is not. Please, please tell me what I'm doing wrong here. I've tried several other solutions (including registry keys as KeyPath instead of CompanionFile) but nothing is quite working.
Here is (most of) the code of the .WXS file:
<Product Id='$(var.ProductCode)'
UpgradeCode='$(var.UpgradeCode)'
Name="Pathways"
Version='$(var.ProductVersion)'
Manufacturer='$(var.Manufacturer)'
Language='1033'>
<Package Id="*"
Description="Pathways Directory Software"
InstallerVersion="301"
Compressed="yes" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<Media Id="1" Cabinet="Pathways.cab" EmbedCab="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion
OnlyDetect="no"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="OLDAPPFOUND"
/>
<UpgradeVersion
Minimum="$(var.ProductVersion)"
IncludeMinimum="yes"
OnlyDetect="no"
Language="1033"
Property="NEWAPPFOUND"
/>
</Upgrade>
<Property Id="ALLUSERS">2</Property>
<!-- directories -->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- program files directory -->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Pathways"/>
</Directory>
<!-- application data directory -->
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="CommonAppDataPathways" Name="Pathways" />
</Directory>
<!-- start menu program directory -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramsMenuPathwaysFolder" Name="Pathways" />
</Directory>
<!-- desktop directory -->
<Directory Id="DesktopFolder" />
</Directory>
<Icon Id="PathwaysIcon" SourceFile="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" />
<!-- components in the reference to the install directory -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="Application" Guid="EEE4EB55-A515-4872-A4A5-06D6AB4A06A6">
<File Id="pathwaysExe" Name="Pathways.exe" DiskId="1" Source="\\Fileserver\Release\Pathways\Latest\Release\Pathways.exe" Vital="yes" KeyPath="yes" Assembly=".net" AssemblyApplication="pathwaysExe" AssemblyManifest="pathwaysExe">
<!--<netfx:NativeImage Id="ngen_Pathways.exe" Platform="32bit" Priority="2"/> -->
</File>
<File Id="pathwaysChm" Name="Pathways.chm" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Pathways.chm" />
<File Id="publicKeyXml" ShortName="RSAPUBLI.XML" Name="RSAPublicKey.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\RSAPublicKey.xml" Vital="yes" />
<File Id="staticListsXml" ShortName="STATICLI.XML" Name="StaticLists.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\StaticLists.xml" Vital="yes" />
<File Id="axInteropMapPointDll" ShortName="AXMPOINT.DLL" Name="AxInterop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\AxInterop.MapPoint.dll" Vital="yes" />
<File Id="interopMapPointDll" ShortName="INMPOINT.DLL" Name="Interop.MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
<File Id="mapPointDll" ShortName="MAPPOINT.DLL" Name="MapPoint.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Interop.MapPoint.dll" Vital="yes" />
<File Id="devExpressData63Dll" ShortName="DAAT63.DLL" Name="DevExpress.Data.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Data.v6.3.dll" Vital="yes" />
<File Id="devExpressUtils63Dll" ShortName="UTILS63.DLL" Name="DevExpress.Utils.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.Utils.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraBars63Dll" ShortName="BARS63.DLL" Name="DevExpress.XtraBars.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraBars.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraNavBar63Dll" ShortName="NAVBAR63.DLL" Name="DevExpress.XtraNavBar.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraNavBar.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraCharts63Dll" ShortName="CHARTS63.DLL" Name="DevExpress.XtraCharts.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraCharts.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraEditors63Dll" ShortName="EDITOR63.DLL" Name="DevExpress.XtraEditors.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraEditors.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraPrinting63Dll" ShortName="PRINT63.DLL" Name="DevExpress.XtraPrinting.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraPrinting.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraReports63Dll" ShortName="REPORT63.DLL" Name="DevExpress.XtraReports.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraReports.v6.3.dll" Vital="yes" />
<File Id="devExpressXtraRichTextEdit63Dll" ShortName="RICHTE63.DLL" Name="DevExpress.XtraRichTextEdit.v6.3.dll" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\DevExpress.XtraRichTextEdit.v6.3.dll" Vital="yes" />
<RegistryValue Id="PathwaysInstallDir" Root="HKLM" Key="Software\Tribal Data Resources\Pathways" Name="InstallDir" Action="write" Type="string" Value="[INSTALLDIR]" />
</Component>
</DirectoryRef>
<!-- application data components -->
<DirectoryRef Id="CommonAppDataPathways">
<Component Id="CommonAppDataPathwaysFolderComponent" Guid="087C6F14-E87E-4B57-A7FA-C03FC8488E0D">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
<RemoveFolder Id="CommonAppDataPathways" On="uninstall" />
<!-- <RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes" />-->
</Component>
<Component Id="Settings" Guid="A3513208-4F12-4496-B609-197812B4A953" NeverOverwrite="yes">
<File Id="settingsXml" KeyPath="yes" ShortName="SETTINGS.XML" Name="Settings.xml" DiskId="1" Source="\\fileserver\Release\Pathways\Dependencies\Settings\settings.xml" Vital="yes" />
</Component>
<Component Id="Database" Guid="1D8756EF-FD6C-49BC-8400-299492E8C65D" >
<!-- <RegistryValue Root="HKLM" Key="Software\TDR\Pathways\Database" Name="installed" Type="integer" Value="1" KeyPath="yes" /> -->
<File Id="pathwaysMdf" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" CompanionFile="pathwaysExe" Vital="yes"/>
<File Id="pathwaysLdf" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf" CompanionFile="pathwaysExe" Vital="yes"/>
</Component>
<!--
<Component Id="MDF" Guid="FFB7CE02-B592-4c44-A315-99CF4828E3D9" >
<File Id="pathwaysMdf" KeyPath="yes" Name="Pathways.mdf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.mdf" />
</Component>
<Component Id="LDF" Guid="9E4E3DCA-A067-47f4-9905-4AD5C35A8025" >
<File Id="pathwaysLdf" KeyPath="yes" Name="Pathways_log.ldf" DiskId="1" Source="\\fileserver\Shared\Databases\Pathways\SystemDBs\Pathways.ldf" />
</Component>
-->
</DirectoryRef>
<!-- shortcut components -->
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcutComponent" Guid="1BF412BA-9C6B-460D-80ED-8388AC66703F">
<Shortcut Id="DesktopShortcut"
Target="[INSTALLDIR]Pathways.exe"
Name="Pathways"
Description="Pathways Tribal Directory"
Icon="PathwaysIcon"
Show="normal"
WorkingDirectory="INSTALLDIR" />
<RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id ="ProgramsMenuPathwaysFolder">
<Component Id="ProgramsMenuShortcutComponent" Guid="83A18245-4C22-4CDC-94E0-B480F80A407D">
<Shortcut Id="ProgramsMenuShortcut" Target="[INSTALLDIR]Pathways.exe" Name="Pathways" Icon="PathwaysIcon" Show="normal" WorkingDirectory="INSTALLDIR" />
<RemoveFolder Id="ProgramsMenuPathwaysFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\TDR\Pathways" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="App" Title="Pathways Application" Level="1" Description="Pathways software" Display="expand" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="Application" />
<ComponentRef Id="CommonAppDataPathwaysFolderComponent" />
<ComponentRef Id="Settings"/>
<ComponentRef Id="ProgramsMenuShortcutComponent" />
<Feature Id="Shortcuts" Title="Desktop Shortcut" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="DesktopShortcutComponent" />
</Feature>
</Feature>
<Feature Id="Data" Title="Database" Level="1" Absent="allow" AllowAdvertise="no" InstallDefault="local">
<ComponentRef Id="Database" />
</Feature>
<UIRef Id ="WixUI_FeatureTree"/>
<UIRef Id="WixUI_ErrorProgressText"/>
<UI>
<Error Id="2000">There is a later version of this program installed.</Error>
</UI>
<CustomAction Id="NewerVersionDetected" Error="2000" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
Running this installer attempting the upgrade from the previous version ALMOST WORKS. The file that is giving me trouble is the one called "PathwaysMdf". Even though it's Component code is EXACTLY the same as the PathwaysLdf file, that file is replaced, while the MDF is NOT. You can see, commented out, some of the other things I've attempted, some from suggestions on stackoverflow.
The entire log file from running the upgrade is located at:
http://pastebin.com/ppjhq6Wi
THANK YOU!
Joshua
Are you following the component rules?
Why are you not using one file per component? Multiple files in a component gets very ugly, very quickly.
(Note that this isn't really a WiX issue, but more likely to be a Windows Installer issue due to violation of component rules)
Why are you setting the CompanionFile attribute for those files to "pathwaysExe"? In doing so, you are asking Windows Installer to base the decision to update those files on whether or not "pathwaysExe" is also updated. Since the version of "pathwaysExe" has not changed (and thus Windows Installer won't updated it), the other files are likewise not updated.
By the way, you say that the .ldf file is updated...Are you sure? The log file you posted indicates otherwise.