I’ve got this below but I want to change it in such a way that it installs the web application to an existing web site. Currently it installs the website and all the files but then on uninstall also removes all the files, I just want it to add the files as a web applications. How so I go about doing this?
<?xml version="1.0" encoding="utf-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="C_IISWebsite" Guid="{138B3868-24E8-4D7B-8793-0D254AF349D4}" KeyPath="yes">
<!-- This does not create a user, it's just an object that's referenced by the WebAppPool component -->
<util:User Id="WebAppPoolUser" CreateUser="no" Name="[WEB_APP_POOL_IDENTITY_USERNAME]"
Password="[WEB_APP_POOL_IDENTITY_PWD]" Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]"/>
<!-- The "Identity" attritbute below needs to be set to "other" to use the util:User defined above -->
<iis:WebAppPool Id="WebAppPool" Name="[WEB_APP_POOL_NAME]" Identity="other" User="WebAppPoolUser"/>
<iis:WebSite Id="DefaultWebSite" Description="[WEBSITE_NAME]" Directory="INSTALLLOCATION" >
<iis:WebAddress Id="AllUnassigned" Port="80"/>
</iis:WebSite>
<iis:WebVirtualDir Id="My.VirtualDir" Alias="mdxWebSite" Directory="INSTALLLOCATION" WebSite="DefaultWebSite">
<iis:WebApplication Id="Application" Name="mdxWebSite" WebAppPool="WebAppPool" />
</iis:WebVirtualDir>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
I think your problem has to do with the installer not knowing what to uninstall, and therefore removes the default or parent web site. Take a look at this sample by John Robbins, the key is to store the configuration in the registry so the uninstall knows what to remove, doing the following inside your
<Component> ... </Compoonent>element should do it, don’t forget to insert your appropriate names/data and guid.