All custom directories, like SHELLPATH are represented as properties and they 
will get their values after CostFinalize (suggested sequence number in 
InstallExecuteSequence - 1000).  Your <Property Id="ISSHELLINSTALLED"... - is 
an AppSearch (suggested sequence 400) and at the time of AppSearch property 
SHELLPATH does not have any value yet.  That is your main problem.  How to fix 
it?  Either use ComponentSearch/FileSearch to find where component/file is 
installed or store [SHELLPATH] in the registry during install and use this 
registry value in your AppSearch.

Also, I am not sure I understand your objectives here.  You don't want your 
users to be able to uninstall your feature once they installed it?

Alex



-----Original Message-----
From: mirram...@googlemail.com [mailto:mirram...@googlemail.com] 
Sent: Monday, October 26, 2009 4:18 PM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Conditional installation depending on file existence

Hi all,

after hours and hours of stabbing in the dark I ask you for your help. I 
have a msi file which contains the following elements:

- <#> <Property Id="*ISSHELLINSTALLED*">
- <#>     <DirectorySearch Id="*CheckShellFileExists*" Path="*[SHELLPATH]*">
          <FileSearch Name="*SoGehtsShell.exe*" />
  </DirectorySearch>
</Property>

...

- <#> <Directory Id="*TARGETDIR*" Name="*SourceDir*">
-     <#> <Directory Id="*ProgramFilesFolder*">
-         <#> <Directory Id="*SoGehtsProgramFilesDir*" Name="*SoGehts 
GmbH*">
-             <#> <Directory Id="*SHELLPATH*" Name="*Shell*">
-                 <#> <Component Id="*SoGehtsShellComponent*" 
DiskId="*1*" Guid="*F99A956C-9671-4F15-BE6C-BE9841852AEF*">
                      <File Id="*_SoGehtsMenu.exe*" 
Name="*SoGehtsMenu.exe*" Source="*D:\So Gehts 10-Film 
Test\Flat\Shell\SoGehtsMenu.exe*" />
                      <File Id="*_SoGehtsTreeUpdate.exe*" 
Name="*SoGehtsTreeUpdate.exe*" Source="*D:\So Gehts 10-Film 
Test\Flat\Shell\SoGehtsTreeUpdate.exe*" />
                      <File Id="*_SoGehtsShell.exe*" 
Name="*SoGehtsShell.exe*" Source="*D:\So Gehts 10-Film 
Test\Flat\Shell\SoGehtsShell.exe*" KeyPath="*yes*" />
                      <File Id="*_SoGehtsShell.mmf*" 
Name="*SoGehtsShell.mmf*" Source="*D:\So Gehts 10-Film 
Test\Flat\Shell\SoGehtsShell.mmf*" />
                      <File Id="*_SoGehtsShell.lic*" 
Name="*SoGehtsShell.lic*" Source="*D:\So Gehts 10-Film 
Test\Flat\Shell\SoGehtsShell.lic*" />
                      <File Id="*_SoGehts.css*" Name="*SoGehts.css*" 
Source="*D:\So Gehts 10-Film Test\Flat\Shell\SoGehts.css*" />
                      <File Id="*_Help.html*" Name="*Help.html*" 
Source="*D:\So Gehts 10-Film Test\Flat\Shell\Help.html*" />
                      <File Id="*_Intro.html*" Name="*Intro.html*" 
Source="*D:\So Gehts 10-Film Test\Flat\Shell\Intro.html*" />
                      <File Id="*_Impressum.html*" 
Name="*Impressum.html*" Source="*D:\So Gehts 10-Film 
Test\Flat\Shell\Impressum.html*" />
                      <File Id="*_Logo.jpg*" Name="*Logo.jpg*" 
Source="*D:\So Gehts 10-Film Test\Flat\Shell\Logo.jpg*" />
                      <File Id="*_Intro.png*" Name="*Intro.png*" 
Source="*D:\So Gehts 10-Film Test\Flat\Shell\Intro.png*" />
                      <RegistryValue Root="*HKLM*" 
Key="*Software\SoGehts GmbH\Shell*" Name="*ShellPath*" Type="*string*" 
Value="*[SHELLPATH]*" />
              </Component>
          </Directory>
      </Directory>
</Directory>

...


- <#> <Directory Id="*ProgramMenuFolder*">
-     <#> <Directory Id="*ApplicationProgramsFolder*" Name="*SoGeht's 
GmbH*">
-         <#> <Component Id="*SoGehtsShortcutComponent*" DiskId="*1*" 
Guid="*F99A956C-9671-4F15-BE6C-BE9841852AE7*">
              <Shortcut Id="*SoGehtsMenuShortcut*" Name="*SoGeht's 
Lernfilme starten*" Directory="*ApplicationProgramsFolder*" 
WorkingDirectory="*SHELLPATH*" Arguments="*/Shell:"[SHELLPATH]" 
/Films:"[FILMSPATH]" /R*" Target="*[SHELLPATH]\SoGehtsMenu.exe*" />
              <RemoveFolder Id="*DeleteShortcutFolder*" On="*uninstall*" 
Directory="*ApplicationProgramsFolder*" />
              <RegistryValue Root="*HKCU*" Key="*Software\SoGehts 
GmbH\Shell*" Name="*ShortcutInstallPath*" Type="*string*" 
Value="*[ApplicationProgramsFolder]*" KeyPath="*yes*" />
              <Shortcut Id="*SoGehtsRemoveShortcut*" Name="*SoGeht's So 
Gehts 10-Film Test Lernfilme deinstallieren*" 
Directory="*ApplicationProgramsFolder*" WorkingDirectory="*SHELLPATH*" 
Arguments="*/x [ProductCode]*" Target="*[System64Folder]msiexec.exe*" />
          </Component>
      </Directory>
  </Directory>

...

- <#> <Feature Id="*SoGehtsShell*" Level="*1*" Title="*SoGeht's 
Benutzeroberfläche*" ConfigurableDirectory="*SHELLPATH*">
      <ComponentRef Id="*SoGehtsShellComponent*" />
      <ComponentRef Id="*SoGehtsShortcutComponent*" />
      <Condition Level="*0*">ISSHELLINSTALLED</Condition>
</Feature>

The objective is, I think, clear: the "SoGehtsShell" Feature must only 
be available when it hasn't been already installed. I inted to detect 
the previous installation by checking wether the file SoGehtsShell.exe 
exists. This sets the ISSHELLINSTALLED property to a non-empty value, 
which should then trigger the Condition in the SoGhetsShell feature. I 
cannot figure out why this does not seem to work at all. No matter 
wether the file is there or not, the component is always installed. 
Reading the logs I found no trace of any ISSHELLINSTALLED condition. 
Looking into the .msi with ORCA I found the "condition" row of the 
"Component" table empty.

I feel not guilty. The xml (in my opinion) contains everything mentioned 
in the WiX Tutorials ("conditional installs"), but it nevertheless does 
not create the msi like I want.

Anyone who can point me in the right direction?

Thanks,

Armin.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to