NetInverse Developers Blog

April 3, 2009
Category: WiX — Tags: , , , — admin @ 9:51 pm

Following sample wxs file demonstrates how to create an MSI to install a web site and virtual directory.

<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
    <Product Id='6197b262-b2d8-464c-9d0b-6cade171b46f'
    Name='WixWebSiteExample'
    Language='1033'
    Version='0.0.0.0' Manufacturer='Corporation'>
        <Package Id='439d5627-cc07-4a41-9f50-b201ae3f8202'
                 Description='Creating a web site with WiX'
                 Comments='Creating a web site with WiX'
                 InstallerVersion='200'
                 Compressed='yes' />

        <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id='ProgramFilesFolder' Name='PFiles'>
                <Directory Id='ApplicationFolder' Name='AppDir' LongName='Test Directory'>
                    <Component Id='WebSiteComponent' Guid='6b27e78e-bcbc-462a-bd7a-50cf991c7d39' DiskId='1'>
                        <File Id='WixExampleFile' Name='simple.txt' src='bin\simple.txt' />
                        <WebSite Id='DefaultWebSite'
                                 Description='My First Web Site Created With WiX'
                                 Directory='ApplicationFolder'>
                            <WebAddress Id="AllUnassigned" Port="80" />
                        </WebSite>
                    </Component>
                    <Component Id="WebVirtualDirComponent" Guid="8d7c59c0-b84d-40d9-b3a5-0c73b6487ae4">
                        <WebVirtualDir Id="VDir"
                                       Alias="Test"
                                       Directory="ApplicationFolder"
                                       WebSite="DefaultWebSite">
                            <WebApplication
                                       Id="TestWebApplication"
                                       Name="Test" />
                        </WebVirtualDir>
                    </Component>
                </Directory>
            </Directory>
        </Directory>

        <Feature Id='TestProductFeature' Title='Wix File Product Feature' Level='1'>
            <ComponentRef Id='WebSiteComponent' />
            <ComponentRef Id='WebVirtualDirComponent' />
        </Feature>
    </Product>
</Wix>

Then you need to compile your WiX file and link it.

         >candle website.wxs
         >light -out wixsite.msi website.wixobj sca.wixlib
         >msiexec /i wixsite.msi

Note that you need to link wixobj with sca.wixlib which is located at your wix\ca folder. Above sample shows you how to create anew web site. If you just want to create a virtual directory under an existing web site, you just need to move the WebSite element out of the Component node. If a new site specifies a port number that collides with the port used by an existing web site, the existing web site will be modified, otherwise a new site will be created.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

©2009 NetInverse. All rights reserved. Powered by WordPress