[wix-users] Simple Wix File Creating Lot Of Problem

Imran baloch imran_ku07 at yahoo.com
Fri Mar 19 04:45:05 PDT 2021


Hi All,
I have very simple requirement. Whenever any of my user install msi then remove the existing files and use the new ones and run some commands to install or remove the exe and add a entry to windows etc folder. 
1) First I get this error ICE03: Invalid Language Id; Table: File, Column: Language, Key(s): Fl_32_MyService.dll2) When I delete all files and try to run the msi then only remove option appears which shows an unknown error. I dont want remove to come.

This is my wix file,

<?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">  <Product Id="*" UpgradeCode="511AC963-BA5A-4875-9058-E5E27600023E" Version="1.0.0.0" Language="1033" Name="My Service" Manufacturer="My Company">    <Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />    <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
    <UIRef Id="WixUI_InstallDir" />    <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />    <Property Id="MSIUSEREALADMINDETECTION" Value="1" />    <Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />
    <!-- Step 1: Define the directory structure -->    <Directory Id="TARGETDIR" Name="SourceDir">      <Directory Id="ProgramFilesFolder">        <Directory Id="INSTALLDIR" Name="My Service">        </Directory>      </Directory>    </Directory>
    <?define Bit32Files=MyService.exe;My;config_ag_ap;MyService.dll;MyLib.lib?>    <?define Bit64Files= MyService.exe;My;config_ag_ap;MyService.dll;MyLib.lib?>
    <!-- Step 2: Add files to your installer package -->    <DirectoryRef Id="INSTALLDIR">
      <?foreach Bit32File in $(var.Bit32Files)?>      <Component Id="Cm_32_$(var.Bit32File)">        <File Id="Fl_32_$(var.Bit32File)" Source="Folder\32\$(var.Bit32File)" KeyPath="yes" />        <Condition><![CDATA[Not VersionNT64]]></Condition>      </Component>      <?endforeach?>
      <Component Id="Cm_32_my_plugin.dll">        <File Id="Fl_32_my_plugin.dll" Source=" Folder\32\dsap-biopos-plugin.dll" KeyPath="yes" />        <Condition><![CDATA[Not VersionNT64]]></Condition>      </Component>
      <?foreach Bit64File in $(var.Bit64Files)?>      <Component Id="Cm_64_$(var.Bit64File)">        <File Id="Fl_64_$(var.Bit64File)" Source=" Folder\64\$(var.Bit64File)" KeyPath="yes" />        <Condition><![CDATA[VersionNT64]]></Condition>      </Component>      <?endforeach?>
      <Component Id="Cm_64_my_plugin.dll">        <File Id="Fl_64_my_plugin.dll" Source=" Folder\64\dsap-biopos-plugin.dll" KeyPath="yes" />        <Condition><![CDATA[VersionNT64]]></Condition>      </Component>
    </DirectoryRef>
    <!-- Step 3: Tell WiX to install the files -->    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <?foreach Bit32File in $(var.Bit32Files)?>      <ComponentRef Id="Cm_32_$(var.Bit32File)" />      <?endforeach?>      <ComponentRef Id="Cm_32_dsap_biopos_plugin.dll" />
      <?foreach Bit64File in $(var.Bit64Files)?>      <ComponentRef Id="Cm_64_$(var.Bit64File)" />      <?endforeach?>      <ComponentRef Id="Cm_64_dsap_biopos_plugin.dll" />    </Feature>
    <!--<CustomAction Id='ExecInsertHostEntry' BinaryKey="CustomActionBinary" DllEntry="AddHostEntry" ></CustomAction>-->    <!--<Binary Id="CustomActionBinary" SourceFile="$(var.ExecAddHostEntry.TargetDir)$(var.ExecAddHostEntry.TargetName).CA.dll" />-->

    <CustomAction Id="ExecInstallService" Directory="INSTALLDIR" Execute="deferred" ExeCommand='cmd.exe /k "MyService.exe -remove & MyService.exe -install & exit"' Return="check" Impersonate="no" />    <CustomAction Id='ExecRemoveService' Directory="INSTALLDIR" Execute="deferred" ExeCommand='cmd.exe /k " MyService.exe -remove & exit"' Return="check" Impersonate="no"></CustomAction>    <CustomAction Id='ExecDeleteFiles' Directory="INSTALLDIR" Execute="deferred" ExeCommand='cmd.exe /k "del /S /F /Q . & exit"' Return="check" Impersonate="no"></CustomAction>    <CustomAction Id='ExecAddHostEntry' Directory="INSTALLDIR" Execute="deferred" ExeCommand='cmd.exe /q /c "find /I """abc.com""" %WINDIR%\System32\drivers\etc\hosts > nul || echo/& echo         127.0.0.1    abc.com>>%WINDIR%\System32\drivers\etc\hosts"' Return="check" Impersonate="no"></CustomAction>    <InstallExecuteSequence>      <Custom Action="ExecInstallService" Before="InstallFinalize" />      <Custom Action="ExecAddHostEntry" After="ExecInstallService" >NOT Installed AND NOT REMOVE</Custom>      <Custom Action="ExecRemoveService" After="ExecInstallService" >(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>      <Custom Action="ExecDeleteFiles" After="ExecRemoveService" >(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>    </InstallExecuteSequence>  </Product></Wix>







Regards,Imran Baloch Microsoft MVP (2011-2016), DZone MVB, MCP, MCTS, MCPD, MCS(Gold Medalist)


More information about the wix-users mailing list