wix - Features installed to different locations but referencing the same components -


i have product consists of multiple features can installed different locations e.g. feature 1 executable installed in program files , feature 2 website installed in wwwroot. both feature 1 , feature 2 rely on many of same dll's , hence require components containing dll's installed in 2 different locations depending on features installed.

is there way achieve without defining every component twice?

to provide further complete example of trying achieve, following complete wxs file can compiled using:

> candle.exe foobar.wxs

> light.exe -ext wixuiextension foobar.wixobj

> msiexec /i foobar.msi

<?xml version='1.0' encoding='windows-1252'?> <wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>    <product name='foobar 1.0'             id='e578df12-dde7-4bc2-82cd-ff11862862d5'             upgradecode='90f09dd5-e01b-4652-8971-515997730195'            language='1033'             codepage='1252'             version='1.0.0'             manufacturer='acme ltd.'>      <package id='*'               keywords='installer'              description="acme 1.0 installer"              installerversion='100'               languages='1033'               compressed='yes'               summarycodepage='1252' />      <media id='1' cabinet='sample.cab' embedcab='yes' diskprompt="cd-rom #1" />     <property id='diskprompt' value="acme 1.0 installation" />      <directory id='targetdir' name='sourcedir'>          <!-- directory 1 (program files) -->         <directory id="programfilesfolder" name="pfiles">             <directory id="program_installdir" name="acme" />         </directory>          <!-- directory 2 (wwwroot) -->         <directory id="inetpub" name="inetpub">             <directory id="wwwroot" name="wwwroot">                 <directory id="website_installdir" name="acmewebsite" />             </directory>         </directory>     </directory>      <directoryref id='program_installdir'>         <component id="component1" guid="79ec9e0b-8325-427b-a865-e1105cb16b62">             <file id="file1" name="file1.txt" source="file1.txt" />         </component>     </directoryref>      <directoryref id='website_installdir'>         <component id="component2" guid="702e6573-8fbc-4269-a58d-fd1157111f0f">             <file id="file2" name="file2.txt" source="file2.txt" />         </component>     </directoryref>      <feature id="feature.program"               title="my program"               typicaldefault="install"               level="1"               configurabledirectory="program_installdir" >         <componentref id="component1"/>         <componentref id="component2"/>     </feature>      <feature id="feature.website"               title="my website"               typicaldefault="install"               level="1"               configurabledirectory="website_installdir" >         <componentref id="component1"/>         <componentref id="component2"/>     </feature>      <uiref id="wixui_mondo" />     <uiref id="wixui_errorprogresstext" />    </product> </wix> 

this result in file1.txt being installed in

c:\program files (x86)\acme

and file2.txt being installed in

_c:\inetpub\wwwroot\acmewebsite_

one solution define components twice such as:

<directoryref id='program_installdir'>     <component id="component1" guid="79ec9e0b-8325-427b-a865-e1105cb16b62">         <file id="file1" name="file1.txt" source="file1.txt" />     </component>     <component id="component2" guid="702e6573-8fbc-4269-a58d-fd1157111f0f">         <file id="file2" name="file2.txt" source="file2.txt" />     </component> </directoryref>  <directoryref id='website_installdir'>     <component id="component1.web" guid="397e93aa-32fb-425a-a783-386e0cca2357">         <file id="file1.web" name="file1.txt" source="file1.txt" />     </component>     <component id="component2.web" guid="5c3aff06-3623-4524-a90b-72b46de5572a">         <file id="file2.web" name="file2.txt" source="file2.txt" />     </component> </directoryref>  <feature id="feature.program"           title="my program"           typicaldefault="install"           level="1"           configurabledirectory="program_installdir" >     <componentref id="component1"/>     <componentref id="component2"/> </feature>  <feature id="feature.website"           title="my website"           typicaldefault="install"           level="1"           configurabledirectory="website_installdir" >     <componentref id="component1.web"/>     <componentref id="component2.web"/> </feature> 

but happens if add third feature installed in location? have redefine every component again? on 100 components, managing duplicate components become big job.

any suggestions?

you seeing limitation in windows installer. component can installed once via msi. each component can installed single directory. have contents of component installed 2 different locations, either have create component same content or try use copyfile element duplicate content.

probably not wanted hear way windows installer works.

fortunately, if chose go option 1, wix toolset compress duplicated content across components once. smart cabbing rocks!


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -