WiX - how to create bin subdirectory?
Asked Answered
S

1

11

I'm missing something obvious. How do you put the .dll's in a subdirectory called "bin" under your install directory? I'm trying to follow this tutorial: http://www.tramontana.co.hu/wix/lesson5.php#5.3 to deploy a WCF web service. So I need to copy the .svc files and the .bin files, along with a few other, but starting with just these two. I'm using Wix 3.5 under Visual Studio.

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLLOCATION" Name="TFBIC.RCT.WCFWebServicesWIXSetup">
                <Component Id="ProductComponent" Guid="E9A375FB-DF6A-4806-8B0B-03BE4A50802F"> 
                    <File Id='SVC1' Name='CreateUpdateReturnService.svc' DiskId='1' Source='../TFBIC.RCT.WCFWebServices/CreateUpdateReturnService.svc'  />
                </Component>
            </Directory>
            <Directory Id="INSTALLLOCATION" Name="TFBIC.RCT.WCFWebServicesWIXSetup">
                <Component Id="ProductComponent" Guid="E9A375FB-DF6A-4806-8B0B-03BE4A50802F">
                    <File Id='DLL1' Name='TFBIC.RCT.WCFWebServices.dll' DiskId='1' Source='../TFBIC.RCT.WCFWebServices/bin/TFBIC.RCT.WCFWebServices.dll'  />
                </Component>
            </Directory>
        </Directory>
        <Component Id='TestWebVirtualDirComponent' Guid='9586807E-9065-48e8-8E73-13A9191962E5'>
            <iis:WebVirtualDir Id='TestWebVirtualDir' Alias='Test' Directory='InstallDir'
              WebSite='DefaultWebSite'>
                <iis:WebApplication Id='TestWebApplication' Name='Test' />
            </iis:WebVirtualDir>
        </Component>

    </Directory>

I tried putting \bin on the ID and the name attribute, and it didn't like either (invalid character).

Also, with IIS, is the best practice to install in c:\program files, or in c:\inetpub\wwwroot? How to I switch the default directory to c:\inetpub\wwwroot\myproj?

These are my various first experiments with WiX.

Selfassertion answered 12/1, 2010 at 20:0 Comment(0)
F
10

Each tag creates a new directory. For each nested tag, there's a new directory. So, if you want to have a "bin" under INSTALLLOCATION, use like below.

<Directory Id="INSTALLLOCATION" Name="TFBIC.RCT.WCFWebServicesWIXSetup"> 
    <Directory Id="BinFolder" Name="bin"> 
        <Component Id="ProductComponent" Guid="E9A375FB-DF6A-4806-8B0B-03BE4A50802F">  
            <File Id='SVC1' Name='CreateUpdateReturnService.svc' DiskId='1' Source='../TFBIC.RCT.WCFWebServices/CreateUpdateReturnService.svc'  /> 
        </Component> 
     </Directory> 
 </Directory>
Flax answered 12/1, 2010 at 20:21 Comment(4)
Thanks, that makes perfect sense! I wasn't thinking about nesting the <Directory> elements.Selfassertion
Also, if you want to have an empty directory, you can use <Directory Id="foo" Name="bar" />Flax
Also, you can alias directories with alternate Id's by adding a <Directory Id="AlternateId"/> child element. This is useful if you are authoring reusable wix components under a DirectoryRef element, as you can't know yet in which folder the applications want to install that component.Congregationalism
This did not work. Says ProductComponent is orphaned. Why are people voting this up?Northrup

© 2022 - 2024 — McMap. All rights reserved.