Search code examples
iiswixwix3

How do you get the default IIS Directory in a Wix install package?


I Would like to set my default install location in Wix to go the default IIS directory

usually C:\inetpub\wwwroot\

in the XML i have

<Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLLOCATION" Name="myProduct">

I Assume i can change either the ProgramFilesFolder directory the the TARGETDIR to one that matches with an IIS property. (in case the default location is moved on a machine)

What would that be?


Solution

  • You can use a registry search to find the location:

    <Property Id="INSTALLLOCATION"> 
        <RegistrySearch Id="FindInetPubFolder" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Name="PathWWWRoot" Type="directory" /> 
    </Property>
    

    But I would caution you that I don't typically do this. I tend to either create new websites or new virtual directories and use use ProgramFiles\Company\Product\WebSites\WebSite as where I put my files. This allows safer integration with whatever other web sites that might also exist on the box.