Check out src\Setup\Msi\Lux.wxs or src\Setup\Msi\VStudio.wxs from wix sources for a working sample: <Component Id="VSSchema2005" Guid="7150C0A6-5626-48B6-AA4C-671754E22706" KeyPath="yes" Win64="no" Directory="TARGETDIR"> <CopyFile Id="CopyWixSchema2005" DestinationProperty="VS2005_SCHEMAS_DIR" FileId="wix.xsd" /> ... </Component>
At first glance Component/@Directory is sourcedir and Component/CopyFile/@DestinationProperty destinationdir... 2011/4/13 Amber Scouras <amber.scou...@thetradedesk.com>: > I'm using WiX 3.5 (an RC from late in 2010). > > My core problem is that I have an installer that needs to deploy the same > files to multiple Components. In this thread on StackOverflow > (http://stackoverflow.com/questions/4941602/features-installed-to-different-locations-but-referencing-the-same-components), > Rob Mensching states: > >>A Component can only be installed once via an MSI. Each Component can only be >>installed to a single Directory. To have the contents of a Component >>installed to two different locations, you either have to create another >>Component with the same content or try to use the CopyFile element to >>duplicate the content. > > The files are referenced in the .wxs via a .wxi include, which means their Id > properties are static. I tried various methods of namespacing these Ids at > include time, but that didn't work for various reasons (I can go into these > if necessary, but would prefer not to for brevity). So, for now, I've > eliminated the possibility of duplicating the File elements per Component. > That leaves me with just the CopyFile option. > > I created a new Component for the shared files that installs to its own > directory and I added a single CopyFile element (using a pattern of "*" in > the SourceName attribute) to each of the existing Components that should copy > the files. The new Component installs correctly but, unfortunately, the > CopyFile elements seem to do nothing. The files just don't copy. In trying > to debug the issue, I installed with msiexec from the command line with full > logging (/lvx*) and could find no trace of relevant file copy logging. > Without any indication of what I'm doing wrong, I can't debug the problem and > I'm hoping somebody on this list can help me. Here are the approaches I've > tried so far (none have worked): > > First Approach > Use CopyFile's SourceDirectory and DestinationDirectory attributes with a > SourceName pattern. Note that I've also tried with a pattern of "*.*", a > pattern of ".*", pattern of "*.dll", and without a pattern (specifying a > single specific file to be copied), which also did not work. > > <Directory Id ="ROOT_INSTALL_DIR"> > <Directory Id ="SERVICES_DIR" Name ="Services"> > <Directory Id="SHARED_BINARIES_DIR" Name="Binaries"> > <Component Id="SharedBinaries" > Guid="49779A88-652A-11E0-AE98-1EF2DFD72085"> > <?include $(var.BUILD_DIR)\Shared.wxi ?> > </Component> > </Directory> > <Directory Id ="SERVICE_ONE_DIR" Name="ServiceOne"> > <Component Id="ServiceOneComponent" > Guid="C743A1E6-7E71-4196-979F-F3218421BCCE"> > <CopyFile Id="ServiceOneSharedBinaries" > SourceDirectory="SHARED_BINARIES_DIR" SourceName="*" > DestinationDirectory="SERVICE_ONE_DIR"/> > </Component> > </Directory> > <!-- More services with similar CopyFile elements --> > </Directory> > </Directory> > > <Feature Id="SharedBinariesFeature" Level="1"> > <ComponentRef Id="SharedBinaries" /> > </Feature> > <Feature Id="ServiceOneFeature" Level="1"> > <ComponentRef Id="ServiceOneComponent"/> > </Feature> > > Second Approach > Use SourceProperty and DestinationProperty attributes instead of the > *Directory attributes. > > <Directory Id ="ROOT_INSTALL_DIR"> > <Directory Id ="SERVICES_DIR" Name ="Services"> > <Directory Id="SHARED_BINARIES_DIR" Name="Binaries"> > <Component Id="SharedBinaries" > Guid="49779A88-652A-11E0-AE98-1EF2DFD72085"> > <?include $(var.BUILD_DIR)\Shared.wxi ?> > </Component> > </Directory> > <Directory Id ="SERVICE_ONE_DIR" Name="ServiceOne"> > <Component Id="ServiceOneComponent" > Guid="C743A1E6-7E71-4196-979F-F3218421BCCE"> > <CopyFile Id="ServiceOneSharedBinaries" > SourceProperty="SHARED_BINARIES_DIR" SourceName="*" > DestinationProperty="SERVICE_ONE_DIR"/> > </Component> > </Directory> > <!-- More services with similar CopyFile elements --> > </Directory> > </Directory> > > <Feature Id="SharedBinariesFeature" Level="1"> > <ComponentRef Id="SharedBinaries" /> > </Feature> > <Feature Id="ServiceOneFeature" Level="1"> > <ComponentRef Id="ServiceOneComponent"/> > </Feature> > > Third Approach > Explicitly create new properties with CustomActions and use those properties > in SourceProperty and DestinationProperty - this seemed silly and redundant, > but it appears that it worked in this thread > (http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/CopyFile-doesn-t-work-td2592289.html). > From the install log, I can tell that the new properties were created > properly, but nothing else seems to have changed: > > <CustomAction Id="SetSharedBinariesDirProperty" > Property="SHARED_BINARIES_DIR_PROPERTY" Value="[SHARED_BINARIES_DIR]"/> > <CustomAction Id="SetServiceOneDirProperty" > Property="SERVICE_ONE_DIR_PROPERTY" Value="[SERVICE_ONE_DIR]"/> > > <Directory Id ="ROOT_INSTALL_DIR"> > <Directory Id ="SERVICES_DIR" Name ="Services"> > <Directory Id="SHARED_BINARIES_DIR" Name="Binaries"> > <Component Id="SharedBinaries" > Guid="49779A88-652A-11E0-AE98-1EF2DFD72085"> > <?include $(var.BUILD_DIR)\Shared.wxi ?> > </Component> > </Directory> > <Directory Id ="SERVICE_ONE_DIR" Name="ServiceOne"> > <Component Id="ServiceOneComponent" > Guid="C743A1E6-7E71-4196-979F-F3218421BCCE"> > <CopyFile Id="ServiceOneSharedBinaries" > SourceProperty="SHARED_BINARIES_DIR_PROPERTY" SourceName="*" > DestinationProperty="SERVICE_ONE_DIR_PROPERTY"/> > </Component> > </Directory> > <!-- More services with similar CopyFile elements --> > </Directory> > </Directory> > > <Feature Id="SharedBinariesFeature" Level="1"> > <ComponentRef Id="SharedBinaries" /> > </Feature> > <Feature Id="ServiceOneFeature" Level="1"> > <ComponentRef Id="ServiceOneComponent"/> > </Feature> > > <InstallExecuteSequence> > <Custom Action="SetSharedBinariesDirProperty" > Before="InstallInitialize"/> > <Custom Action="SetServiceOneDirProperty" Before="InstallInitialize"/> > </InstallExecuteSequence> > > > Any help or insight is greatly appreciated! > > Amber Scouras // Senior Software Engineer // The Trade Desk > follow us @ twitter<http://twitter.com/TheTradeDeskinc> // > facebook<http://www.facebook.com/TheTradeDesk> // > linkedin<http://www.linkedin.com/company/892001> // > www.thetradedesk.com<http://www.thetradedesk.com/> > > This email could contain material that is subject to copyright or trade > protection, confidential and/or privileged and, in all cases, provided for > the sole use of the intended recipient. Any reliance or distribution by > others or forwarding without express permission is strictly prohibited. If > you are not the intended recipient, please contact the sender and delete all > copies. > > ------------------------------------------------------------------------------ > Forrester Wave Report - Recovery time is now measured in hours and minutes > not days. Key insights are discussed in the 2010 Forrester Wave Report as > part of an in-depth evaluation of disaster recovery service providers. > Forrester found the best-in-class provider in terms of services and vision. > Read this report now! http://p.sf.net/sfu/ibm-webcastpromo > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users