Hi Ben, I have resolved all install/uninstall issues with websites in IIS with the code below. By storing properties in registry and reading them back, all works fine.
I have included the port, description (name), hostheader value and IP address as registry values. This allows me to have multiple websites on same port or different ports if they use host header. Also, I can have multiple sites and the default website and the correct site is uninstalled without affecting default website. Thx to the following link for suggesting storing values in registry: http://n2.nabble.com/Default-website-gets-removed-on-Uninstall-td731259 Code in the wxs file is listed below: ---------------------------------------- 1. Put all IIS: in components like this ---------------------------------------- <Directory Id="TARGETDIR" Name="SourceDir"> <Component Id="WebsiteIPComponent" Guid="{SOMEGUID}"> <RegistryValue Id="WebsiteIP" Root="HKLM" Key="Software\CompanyName\[ProductName]" Name="WebsiteIP" Value="[WEBSITEIP]" Type="string"/> </Component> <Component Id="WebsitePortComponent" Guid="{SOMEGUID}"> <RegistryValue Id="WebsitePortNbr" Root="HKLM" Key="Software\CompanyName\[ProductName]" Name="WebsitePortNbr" Value="[WEBSITEPORT]" Type="string"/> </Component> <Component Id="WebsiteDescComponent" Guid="{SOMEGUID}"> <RegistryValue Id ="WebsiteDescription" Root="HKLM" Key="Software\CompanyName\[ProductName]" Name="WebsiteDescription" Value="[WEBSITEDESCRIPTION]" Type="string"/> </Component> <Component Id="WebsiteHostHeaderComponent" Guid="{SOMEGUID}"> <RegistryValue Id = "WebsiteHostHeader" Root="HKLM" Key="Software\CompanyName\[ProductName]" Name="WebsiteHostHeader" Value="[WEBSITEHOSTHEADER]" Type="string"/> </Component> <Component Id="NewWebsiteConfigASP" Guid="{SOMEGUID}"> <iis:WebSite Id="IISWebsite" Description="[WEBSITEDESCRIPTION]" Directory="TARGETDIR" AutoStart="yes" ConfigureIfExists="yes" StartOnInstall="yes"> <iis:WebAddress Id="IISWebAddress" Port="[WEBSITEPORT]" IP="[WEBSITEIP]" Header="[WEBSITEHOSTHEADER]" /> <iis:WebDirProperties Id="IISWebDirProperties" Execute="yes" Read="yes" DefaultDocuments="default.aspx,index.aspx,index.htm,index.html,default.h tm,default.html" /> <iis:WebDir Id="IISAppDataWebDir" Path="App_Data"> <iis:WebDirProperties Id="IISAppDataWebDirProperties" Write="yes" Read="yes" DefaultDocuments="default.aspx,index.aspx,index.htm,index.html,default.h tm,default.html" /> </iis:WebDir> <iis:WebApplication Id="WebApplication" Name="[WEBAPPLICATIONNAME]" WebAppPool="WebAppPool"> </iis:WebApplication> </iis:WebSite> <iis:WebAppPool Id="WebAppPool" Name="[WEBAPPLICATIONPOOLNAME]" Identity="networkService" /> <Condition>TARGETMODE = "NewWebsite" AND SCRIPTLANGUAGE = "ASP"</Condition> </Component> <Component Id="ExistingWebsiteConfigASP" Guid="{SOMEGUID}"> <iis:WebSite Id="IISWebsiteExisting" Description="[WEBSITEDESCRIPTION]" ConfigureIfExists="no" Directory="TARGETDIR"> <iis:WebAddress Id="IISWebAddressExisting" Port="[WEBSITEPORT]" IP="[WEBSITEIP]" Header="[WEBSITEHOSTHEADER]" /> <iis:WebVirtualDir Id="WebVirtualDirectory" Alias="[VIRTUALDIRECTORYNAME]" Directory="TARGETDIR"> <iis:WebDirProperties Id="IISWebVirtualDirPropertiesExisting" Execute="yes" Read="yes" DefaultDocuments="default.aspx,index.aspx,index.htm,index.html,default.h tm,default.html" /> <iis:WebApplication Id="WebApplicationExisting" Name="[WEBAPPLICATIONNAME]" WebAppPool="WebAppPoolExisting"> </iis:WebApplication> </iis:WebVirtualDir> </iis:WebSite> <Condition>TARGETMODE = "ExistingWebsite" AND SCRIPTLANGUAGE = "ASP"</Condition> <iis:WebAppPool Id="WebAppPoolExisting" Name="[WEBAPPLICATIONPOOLNAME]" Identity="networkService" /> </Component> . . . </Directory> ---------------------------------------- 2. Add componentref's in your feature like this: ---------------------------------------- <Feature Id="WebsiteFeature" Title="Website Installation" Description="This feature will install the website component" Level="1" Display="expand"> . . . <ComponentRef Id="WebsiteIPComponent" /> <ComponentRef Id="WebsitePortComponent" /> <ComponentRef Id="WebsiteDescComponent" /> <ComponentRef Id="WebsiteHostHeaderComponent" /> . . . </Feature> ---------------------------------------------------------- 3. Add properties and get values from registry like this: ---------------------------------------------------------- <Property Id="WEBSITEIP"> <RegistrySearch Id="WebsiteIP" Root="HKLM" Type="raw" Name="WebsiteIP" Key="Software\CompanyName\[ProductName]"/> </Property> <Property Id="WEBSITEPORT"> <RegistrySearch Id="WebsitePortNbr" Root="HKLM" Type="raw" Name="WebsitePortNbr" Key="Software\CompanyName\[ProductName]"/> </Property> <Property Id="WEBSITEDESCRIPTION"> <RegistrySearch Id="WebsiteDescription" Root="HKLM" Type="raw" Name="WebsiteDescription" Key="Software\CompanyName\[ProductName]"/> </Property> <Property Id="WEBSITEHOSTHEADER"> <RegistrySearch Id="WebsiteHostHeader" Root="HKLM" Type="raw" Name="WebsiteHostHeader" Key="Software\CompanyName\[ProductName]"/> </Property> Hope this helps. Thx, Craig -----Original Message----- From: Benjamin Podszun [mailto:benjamin.pods...@gmail.com] Sent: Tuesday, October 13, 2009 10:05 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Removing WebVirtualDir / WebApplication on uninstallonly Hi. I can successfully deploy an application that includes a web application among others (thanks to this list) like this: <!-- Inside a component --> <iis:WebVirtualDir Id="SomeWebApp" Alias="SomeAlias" Directory="INSTALLLOCATION" WebSite="DefaultWebSite"> <iis:WebApplication Id="SomeWebApp" Name="SomeName" /> <iis:WebDirProperties Id="SomeDirProps" DefaultDocuments="Some.asmx" /> </iis:WebVirtualDir> <!-- Component ends around here --> <!-- Website reference - not in a component --> <iis:WebSite Id='DefaultWebSite' Description='Default Web Site' Directory='INSTALLLOCATION'> <iis:WebAddress Id="AllUnassigned" Port="80" /> </iis:WebSite> This works fine, but leaves the web application in place (and a uninstall/reinstall cycle fails, because the web application "SomeName" exists already..). I understand that I could move the WebSite declaration into a component, but according to my understanding so far that would remove the default website in my case (which is shared). Is there any workaround for that? Am I supposed (forced?) to create a website in my component for uninstall support? Thanks a lot in advance, Ben ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users