0

I am trying to install some files to WindowsFolder. Here is the markup:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="MyAppSetup" Language="1033" Version="1.0.0.0" Manufacturer="abc" UpgradeCode="C313D73A-0FE5-496C-BD86-C21565BD65ED">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="MyAppSetup" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="WindowsFolder">
                <Directory Id="INSTALLFOLDER" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
     <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="myApp1" Guid="13B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myApp.pdb" Source="myApp64.pdb" KeyPath="yes" />
      </Component>
      <Component Id="myApp2" Guid="23B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myApp.sys" Source="myApp64.sys" KeyPath="yes" />
      </Component>
      <Component Id="myApp3" Guid="33B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myAppsvc.exe" Source="myAppsvc64.exe" KeyPath="yes" />
      </Component>
      <Component Id="myApp4" Guid="43B43FD7-8D69-4D2E-BF03-B3EC5679D78A">
        <File Id="myAppsvc.pdb" Source="myAppsvc64.pdb" KeyPath="yes" />
      </Component>
     </ComponentGroup>
    </Fragment>
</Wix>

Based on my reading, this directory element specifies the files to be installed/copied under WindowsFolder (on my machine C:\windows), but instead, it installs files to D:\ which has the most space. So the question is : what did I do wrong on the directory?

8
  • It looks legit. Try to enable logging and post the warnings\errors related to the installdir. msiexec /i "your.msi" /l*v "msi.log" Commented Mar 18, 2014 at 23:18
  • Windows Installer Pro Tip: Whenever directory table entries fail to resolve the properties will get set to the root of the largest available drive. Commented Mar 18, 2014 at 23:45
  • Log did show installer was changing property value: PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:\'. PROPERTY CHANGE: Modifying WindowsFolder property. Its current value is 'C:\windows\'. Its new value: 'D:\'. But why? Commented Mar 19, 2014 at 1:52
  • Here is the Directory table in OACR, it seems wrong: APPLICATIONROOTDIRECTORY WindowsFolder 0aoqdfe1|TestApplicationName Commented Mar 19, 2014 at 1:58
  • OK, after I manually removed the "0aoqdfe1" from the ORCA tool and saved the msi, the installer finally made the files to the directory I want. Thanks for pointing to directory table resolving. But the mystery is still why the gibberish in there? Commented Mar 19, 2014 at 2:05

1 Answer 1

1

It turns out that the Directory reset happens when the msi is launched through msiexec using /a (admin) option. Here is a few log entries show this:

PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:\'.
PROPERTY CHANGE: Modifying WindowsFolder property. Its current value is 'C:\windows\'. Its new value: 'D:\'.
PROPERTY CHANGE: Adding APPLICATIONROOTDIRECTORY property. Its value is 'D:\'.

If msi is launched using /i option, then the Directory reset is not happening. Since package needs to be installed with elevated privilege, the correct way to do this is using /i option in a elevated CMD console. The markup was never the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.