Either take it out of the fragment or use a DirectoryRef.

<Fragment>
   <DirectoryRef Id="TARGETDIR">
      <Directory Id="AppDataFolder">
        <Directory Id="dir6A68E13632B544EDA8F393F83B23F439" Name="Microsoft">
          <Directory Id="dir03FB174C3B8F4214AF6A130B8EAA7BA1" Name="Crypto">
            <Directory Id="dirE956646E44EE4A23B07BD0A84D969F55" Name="RSA">
              <Directory Id="dir9210B4F4F4A24357A3954AFC771C9E28"
Name="MachineKeys">
                <Component Id="MachineKeysFolderPermissions"
Guid="352963FCB3794D8E9B9BE725929B5C47">
                  <CreateFolder>
                    <util:PermissionEx User="NETWORK SERVICE"
GenericAll="yes" ChangePermission="yes"  />
                  </CreateFolder>
                </Component>
              </Directory>
            </Directory>
         </Directory>
        </Directory>
      </Directory>
    </DirectoryRef>
</Fragment>

I usually leave my directory structure in the main wxs and wrap the component
in a directoryRef in the fragment.

It all depends on why you are using a fragment really.


-----Original Message-----
From: CoolBreeze [mailto:coolbreeze...@googlemail.com] 
Sent: 14 June 2011 16:16
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Help with giving permissions to folder

I knew there was something I was probably missing. I've added the
componentRef, but the build fails with the following error:

The primary key 'TARGETDIR' is duplicated in table 'Directory'.  Please
remove one of the entries or rename a part of the primary key to avoid the
collision.

It is true that I already have a TARGETDIR for the install within my
Product.wxs, but if I don't add a TARGETDIR and SourceDir to the Fragment
that contains the folder I want to set the ACL on, it fails to build.

How can I get this to work? I've tried to vary the values for TARGETDIR and
name, but I always receive an error stating that the root directory is not
valid or that the TARGETDIR directory has an illegal DefaultDir value.

In my Fragment file, if I don't include TARGETDIR and Name="SourceDir" I get
an error stating that "AppDataFolder" is not a valid root directory.


On Tue, Jun 14, 2011 at 9:52 AM, David Watson <dwat...@sdl.com> wrote:

> If you reference anything in a fragment then the entire fragment will be
> included in your installer.
>
> So if you add a componentRef in your feature this fragment will be
> included.
>
>
> -----Original Message-----
> From: CoolBreeze [mailto:coolbreeze...@googlemail.com]
> Sent: 14 June 2011 14:20
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Help with giving permissions to folder
>
> Thanks for you help. I understand now. Can you tell what I might have
> missed
> to cause the ACL not to be set on the MachineKeys folder? Have I missed
> something in how I've configured this? I've added the following code to a
> separate Fragment file and my understanding is that this file will be
> pulled
> into the installer. I have not referenced the file anywhere.
>
> The full path to the MachineKeys folder is:
> C:\Documents and Settings\All Users\Application
> Data\Microsoft\Crypto\RSA\MachineKeys
>
> <Fragment>
>    <Directory Id="TARGETDIR" Name="SourceDir">
>      <Directory Id="AppDataFolder">
>        <Directory Id="dir6A68E13632B544EDA8F393F83B23F439"
> Name="Microsoft">
>          <Directory Id="dir03FB174C3B8F4214AF6A130B8EAA7BA1" Name="Crypto">
>            <Directory Id="dirE956646E44EE4A23B07BD0A84D969F55" Name="RSA">
>              <Directory Id="dir9210B4F4F4A24357A3954AFC771C9E28"
> Name="MachineKeys">
>                <Component Id="MachineKeysFolderPermissions"
> Guid="352963FCB3794D8E9B9BE725929B5C47">
>                  <CreateFolder>
>                    <util:PermissionEx User="NETWORK SERVICE"
> GenericAll="yes" ChangePermission="yes"  />
>                  </CreateFolder>
>                </Component>
>              </Directory>
>            </Directory>
>          </Directory>
>        </Directory>
>      </Directory>
>    </Directory>
>  </Fragment>
>
> Thanks again for your help.
>
>
> On Tue, Jun 14, 2011 at 7:43 AM, David Watson <dwat...@sdl.com> wrote:
>
> > No it will not overwrite it or cause it to be removed on uninstall.
> >
> > The code example is to set permissions on the windows\temp folder which
> > pre-exists and the permission is added to the ACL of the folder.
> >
> >
> >
> > -----Original Message-----
> > From: CoolBreeze [mailto:coolbreeze...@googlemail.com]
> > Sent: 14 June 2011 11:15
> > To: General discussion for Windows Installer XML toolset.
> > Subject: Re: [WiX-users] Help with giving permissions to folder
> >
> > I do not want to recreate or overwrite the MachineKeys folder that
> already
> > exists. Will adding <CreateFolder /> as you suggest below overwrite the
> > existing folder? If so, how can I avoid that, but still add the
> permission
> > I
> > need to the folder?
> >
> > On Tue, Jun 14, 2011 at 5:23 AM, David Watson <dwat...@sdl.com> wrote:
> >
> > > The relevant parent of util:permissionex is createfolder.
> > >
> > > Put a component in your directory tree that has a CreateFolder with a
> > > permissionsEx nexted in it.
> > >
> > > An example...
> > >
> > > <Directory Id="windowstemp" Name="temp">
> > >        <Component Id="windowstempPerm" Guid="*">
> > >          <RegistryValue Id="windowstempfolderpermissions" Type="string"
> > > Action="write" Value="1" Root="HKLM" Key="$(var.RegistryPath)"
> > > Name="windowstempfolderpermissions" KeyPath="yes"/>
> > >          <CreateFolder>
> > >            <util:PermissionEx GenericAll="yes" User="$(var.GroupName)"
> > > Domain="[ComputerName]" />
> > >          </CreateFolder>
> > >        </Component>
> > >      </Directory>
> > >
> > > -----Original Message-----
> > > From: CoolBreeze [mailto:coolbreeze...@googlemail.com]
> > > Sent: 13 June 2011 17:28
> > > To: General discussion for Windows Installer XML toolset.
> > > Subject: [WiX-users] Help with giving permissions to folder
> > >
> > > My installer needs to encrypt the ConnectionStrings section of the
> > > web.config file for our web application. This part I have working with
> no
> > > problems, but as part of the process I need to provide the Network
> > Service
> > > with full control access to the following folder:
> > >
> > > *C:\Documents and Settings\All Users\Application
> > > Data\Microsoft\Crypto\RSA\MachineKeys*
> > >
> > > I have not been able to figure out how to configure this with in my
> > > installer.
> > >
> > > I've tried adding the following to my Product.wxs, but it gives a build
> > > error of: "The Directory element contains an unexpected child element
> > > 'util:PermissionEx'.". And xmlns:util has been added to the beginning
> of
> > my
> > > Product.wxs.
> > >
> > > <Directory Id="TARGETDIR" Name="SourceDir">
> > >     <Directory Id="WebSiteAppsFolder">
> > >         <Directory Id="INSTALLLOCATION" Name="!(loc.ProductName)">
> > >        </Directory>
> > >        <Directory Id="AppDataFolder">
> > >          <Directory Id="Microsoft">
> > >            <Directory Id="Crypto">
> > >              <Directory Id="RSA">
> > >                <Directory Id="MachineKeys">
> > >                  <util:PermissionEx User="NETWORK SERVICE"
> > GenericAll="yes"
> > > ChangePermission="yes"  />
> > >                </Directory>
> > >              </Directory>
> > >            </Directory>
> > >          </Directory>
> > >      </Directory>
> > >   </Directory>
> > > </Directory>
> > >
> > > How can this be done?
> > >
> > >
> >
> >
>
>
-----------------------------------------------------------------------------
> > > -
> > > EditLive Enterprise is the world's most technically advanced content
> > > authoring tool. Experience the power of Track Changes, Inline Image
> > > Editing and ensure content is compliant with Accessibility Checking.
> > > http://p.sf.net/sfu/ephox-dev2dev
> > > _______________________________________________
> > > WiX-users mailing list
> > > WiX-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > > SDL PLC confidential, all rights reserved.
> > > If you are not the intended recipient of this mail SDL requests and
> > > requires that you delete it without acting upon or copying any of its
> > > contents, and we further request that you advise us.
> > > SDL PLC is a public limited company registered in England and Wales.
> > >  Registered number: 02675207.
> > > Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire
> > SL6
> > > 7DY, UK.
> > >
> > >
> > >
> > >
> >
> >
>
>
-----------------------------------------------------------------------------
> > -
> > > EditLive Enterprise is the world's most technically advanced content
> > > authoring tool. Experience the power of Track Changes, Inline Image
> > > Editing and ensure content is compliant with Accessibility Checking.
> > > http://p.sf.net/sfu/ephox-dev2dev
> > > _______________________________________________
> > > WiX-users mailing list
> > > WiX-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > >
> >
> >
>
>
-----------------------------------------------------------------------------
> > -
> > EditLive Enterprise is the world's most technically advanced content
> > authoring tool. Experience the power of Track Changes, Inline Image
> > Editing and ensure content is compliant with Accessibility Checking.
> > http://p.sf.net/sfu/ephox-dev2dev
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> >
> >
>
>
-----------------------------------------------------------------------------
> -
> > EditLive Enterprise is the world's most technically advanced content
> > authoring tool. Experience the power of Track Changes, Inline Image
> > Editing and ensure content is compliant with Accessibility Checking.
> > http://p.sf.net/sfu/ephox-dev2dev
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
>
>
-----------------------------------------------------------------------------
> -
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
-----------------------------------------------------------------------------
-
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
-----------------------------------------------------------------------------
-
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to