I am trying to create a basic WiX installer for my web API application, as a part of installer i would like it to create web directory and web application for the project. I have the below code with is doing everything except, it doesn't create the web application. I would like the iss folder structure to look like
This is my code:
<Fragment>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME">
<Directory Id="DiagonalFolder" Name="Diagonal">
<Directory Id="ServicesFolder" Name="WebServices">
<Directory Id="LocationServicesFolder" Name="LocationServices">
<!-- Since the installation directory is not 'Program Files', MUST use ComponentGuidGenerationSeed which MUST NEVER CHANGE for life of Product -->
<Directory Id="INSTALLFOLDER" Name="Bin" ComponentGuidGenerationSeed="PUT-GUID-HERE">
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="IISComponentGroup" Directory="TARGETDIR">
<!--The component to define the Virtual Directory-->
<Component Id="IIS.Component" Guid="*" KeyPath="yes">
<iis:WebVirtualDir Id="VDir" Alias="api" Directory="ServicesFolder" WebSite="DefaultWebSite">
<!--Turn the Virtual Directory into a web application-->
<iis:WebApplication Id="WebApplication" Name="ls" WebAppPool="TheAppPool">
</iis:WebApplication>
</iis:WebVirtualDir>
<iis:WebAppPool Id="TheAppPool" Name="DefaultAppPool" ></iis:WebAppPool>
<CreateFolder/>
</Component>
</ComponentGroup>
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site" Directory="TARGETDIR">
<!-- This element has to be here or WiX does not compile. It’s ignored in this case.-->
<iis:WebAddress Id="AllUnassigned" IP="*" Port="8080" />
</iis:WebSite>
</Fragment>
This creates the web application folder named 'api' instead of web dir and does not create web application with name 'ls'. it should look like localhost/api/ls