Hi Phill

Unfortunately the per-user version of CommonFilesFolder requires Windows 
Installer 5.0 (Win 7) and, even more unfortunately, we still have to support 
XP. What you have does indeed build without warnings but, unless you explicitly 
run msiexec elevated, the per-user installer fails with "The installer has 
insufficient privileges to access this directory...."

Thanks anyway
Kevin

------------------------------

Date: Mon, 1 Jul 2013 13:04:26 -0700 (PDT)
From: Phill Hogland <phogl...@rimage.com>
Subject: Re: [WiX-users] per-user/per-machine in MSM, MSI and bundle
To: wix-users@lists.sourceforge.net
Message-ID: <1372709066856-7587041.p...@n2.nabble.com>
Content-Type: text/plain; charset=us-ascii

I have been following this thread, and while I am pretty new I decided to
play with this problem as a learning experience.  I created the following
modules, which are slightly different from your code, which compile and do
not generate any warnings or errors.  I think the main change I made was to
use CommonFilesFolder in the perUser.  I did this because the msdn link in
this thread indicates that it will switch locations for ALLUSERS and I
always got errors using LocalAppDataFolder.  I do not have a test box handy
so I may be on a rabbit trial and have something that compiles but does not
do what you want.

MSM.wxs
-----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
        <Module Id="MSM" Language="1033" Version="1.0.0.0">
                <Package Id="a60c4f05-c2b2-4cb8-baab-b8d37320fea8" 
Manufacturer="test"
InstallerVersion="200" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="MergeRedirectFolder">
        <Component Id="MsmComponent"
Guid="{49CD0F4B-A744-41A7-85E2-09B71B4C7FD6}">
          <File Id="MsmComponent.File" KeyPath="no"
Source="C:\Windows\notepad.exe"/>
          
          <RegistryKey Root="HKMU" Key="SOFTWARE\test\keypath">
            <RegistryValue Name="MsmComponent.File" Value="1" Type="integer"
KeyPath="yes" />
          </RegistryKey>
          <RemoveFolder Id="DelMergeRedirectFolder" On="uninstall"/>
        </Component>
      </Directory>
    </Directory>
        </Module>
</Wix>

MachineMSI.wix
----------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
        <Product Id="*" Name="MachineMSI" Language="1033" Version="1.0.0.0"
Manufacturer="Company" UpgradeCode="a3b63a3c-6a71-4e07-b061-2c1be70b2f5e">
                <Package InstallerVersion="200" Compressed="yes" 
InstallScope="perMachine"
/>

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

                <Feature Id="ProductFeature" Title="MachineMSI" Level="1">
      <MergeRef Id="MSM"/>
    </Feature>
        </Product>

        <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="CommonFilesFolder">
        <Directory Id="INSTALL_FOLDER" Name="Company">
          <Merge Id=&quot;MSM&quot; SourceFile=&quot;&lt;path to
msm>\msm.msm" DiskId="1" Language="1033"/>
        </Directory>
      </Directory>
    </Directory>
        </Fragment>

</Wix>

UserMSI.wxs
--------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
        <Product Id="*" Name="UserMsi" Language="1033" Version="1.0.0.0"
Manufacturer="Company" UpgradeCode="924f8f16-3f9a-4724-8811-6044e92018ad">
                <Package InstallerVersion="200" Compressed="yes" 
InstallScope="perUser" />

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

                <Feature Id="ProductFeature" Title="UserMsi" Level="1">
      <MergeRef Id="MSM"/>
                </Feature>
        </Product>

        <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="CommonFilesFolder">
        <Directory Id="INSTALL_FOLDER" Name="Company">
          <Merge Id=&quot;MSM&quot; SourceFile=&quot;&lt;path to
msm>\msm.msm" DiskId="1" Language="1033"/>
        </Directory>
      </Directory>
    </Directory>
 </Fragment>

  <Fragment>
    <DirectoryRef Id="INSTALL_FOLDER">
      <Component Id="removeINSTALL_FOLDER">
        <RemoveFolder Id="removeINSTALL_FOLDER" Directory="INSTALL_FOLDER"
On="uninstall"/>
      </Component>
    </DirectoryRef>
  </Fragment>
</Wix>

I hope this helps.  Please let me know if I should have done something
different.
Phill


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to