How to add an Application to an existing IIS Site using WiX - iis

I am wanting to add an Application to an existing IIS Site which is not the default IIS Site. This is not a usual request, but is required when deploying to a Win 2008 SBS, MVC Web API applications must be moved under 'SBS Web Applications' to work correctly.
In IIS, I would right mouse button on the 'SBS Web Applications' > Add Application... and set the Alias, Application Pool & Physical Path.
Wix does not allow me to set these properties on an IIS:WebApplication, further more it looks like I need to use a IIS:WebVirtualDir, but I don't want or need to do this. I simply need to point the Physical Path attribute to where my API is installed for this to work.
Why can't I tell the WiX IIS:WebApplication the Alias & Path that I want as per the IIS UI?
Of all the WiX work I have done, I would have thought this would have been one of the easier things to do.
Note: I want to create the Application, I don't want or need to create the Site - it's already there.

You can achieve the specified goals with WIX. I have even more complex variant: installing either to new Web site or existing one, for IIS 6, IIS 7 and IIS 7.5.
As for installing into existing web site, WIX identifies the site based on SiteId. If your site has non-autogenerated ID, you need to specify it explicitly instead of setting * in the corresponding field. Otherwise siteId is generated based on it's Description attribute, so you need to specify description correctly to reference the existing site.
Here follows my implementation (I hope you can extract what you need from it):
<PropertyRef Id="FRAMEWORKROOT"/>
<PropertyRef Id="SITE_INSTALL_MODE"/>
<PropertyRef Id="SITE_NAME"/>
<PropertyRef Id="SITE_PORT"/>
<PropertyRef Id="SITE_VIRT_DIR"/>
<PropertyRef Id="SITE_APP_NAME"/>
<PropertyRef Id="SITE_HEADER"/>
<PropertyRef Id="SITE_APP_POOL"/>
<PropertyRef Id="SITE_ID"/>
<Property Id="SITE_APP_NAME" Value="{ProductId}"/>
<iis:WebApplication Id="IIS6WebApp" Name="[SITE_APP_NAME]" WebAppPool="AppPool" >
<iis:WebApplicationExtension Verbs="GET,HEAD,POST" CheckPath="no" Script="yes" Executable="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" />
</iis:WebApplication>
<iis:WebApplication Id="Iis7WebApp" Name="[SITE_APP_NAME]" WebAppPool="AppPool"></iis:WebApplication>
<iis:WebSite Id="ExistingWebSite" Description="[EXISTING_SITE_NAME]" SiteId="*">
<iis:WebAddress Id="ExistingSite_IIS7_Header_Binding" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
<util:Group Id="IisUsersGroup" Name="[IisGroup]" Domain="[ComputerName]"/>
<DirectoryRef Id="SITE_INSTALLDIR">
<Component Id="AppPoolConfigure" Guid="YOURGUID-5549-48E8-B989-AFC61D279527" KeyPath="yes" Permanent="no">
<util:User Id="SiteUser" Domain="[APP_USER_DOMAIN]" Name="[APP_USER_NAME]" Password="[APP_USER_PASSWORD]" CreateUser="no" UpdateIfExists="no" RemoveOnUninstall="no">
<util:GroupRef Id="IisUsersGroup"/>
</util:User>
<iis:WebAppPool Id="AppPool" Name="[SITE_APP_POOL]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" Identity="other" User="SiteUser" />
</Component>
<Component Id="Iis6NewSiteConfigure" Guid="YOURGUID-8592-4E69-8D80-E42745307D7A" KeyPath="yes" Permanent="no">
<Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "NewSite" AND IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
<iis:WebSite Id="NewWebSite_IIS6" Description="[SITE_NAME]"
AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="no"
Directory="SITE_INSTALLDIR" ConnectionTimeout="360" SiteId="[SITE_ID]"
DirProperties="WebDirProperties" WebApplication="IIS6WebApp">
<iis:WebAddress Id="Site_IIS6_Header_Bindings" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
</Component>
<Component Id="Iis6ExistingSiteConfigure" Guid="YOURGUID-8ECB-4AC3-95B1-B7287D0AC903" KeyPath="yes" Permanent="no">
<Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "ExistingSiteNewVDir" AND IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
<iis:WebVirtualDir Id="Site_IIS6_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]" WebSite="ExistingWebSite"
DirProperties="WebDirProperties" WebApplication="IIS6WebApp"/>
</Component>
<Component Id="Iis6ConfigExtentions" Guid="YOURGUID-55F2-48E3-8B08-E37BA5137D8D" KeyPath="yes" Permanent="yes">
<Condition><![CDATA[Installed OR (IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
<iis:WebServiceExtension Id="ExtensionASP4" Group="ASP.NET v4.0.30319" Allow="yes" File="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" Description="ASP.NET v4.0.30319"/>
</Component>
<Component Id="Iis7NewSiteConfigure" Guid="YOURGUID-5DF6-4071-94F4-89D1EDAE8D90" KeyPath="yes" Permanent="no">
<Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "NewSite" AND IISMAJORVERSION AND (IISMAJORVERSION > "#6"))]]></Condition>
<iis:WebSite Id="WebSite_IIS7" Description="[SITE_NAME]"
AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
Directory="SITE_INSTALLDIR" ConnectionTimeout="360" SiteId="[SITE_ID]"
DirProperties="WebDirProperties" WebApplication="Iis7WebApp">
<iis:WebAddress Id="NewSite_IIS7_Header_Binding" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
</Component>
<Component Id="Iis7ExistingSiteConfigure" Guid="YOURGUID-FBBE-4379-8C7B-CDBD08EDCBA2" KeyPath="yes" Permanent="no">
<Condition><![CDATA[Installed OR (SITE_INSTALL_MODE = "ExistingSiteNewVDir" AND IISMAJORVERSION AND (IISMAJORVERSION > "#6"))]]></Condition>
<iis:WebVirtualDir Id="Site_IIS7_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]" WebSite="ExistingWebSite"
DirProperties="WebDirProperties" WebApplication="Iis7WebApp"/>
</Component>
</DirectoryRef>
<ComponentGroup Id="IisSiteOrVDirCreate">
<ComponentRef Id="AppPoolConfigure"/>
<ComponentRef Id="Iis6NewSiteConfigure"/>
<ComponentRef Id="Iis6ExistingSiteConfigure"/>
<ComponentRef Id="Iis6ConfigExtentions"/>
<ComponentRef Id="Iis7NewSiteConfigure"/>
<ComponentRef Id="Iis7ExistingSiteConfigure"/>
</ComponentGroup>
<CustomAction Id="SetIisGroupToIUSRS" Property="IisGroup" Value="IIS_IUSRS" />
<CustomAction Id="SetIisGroupToWPG" Property="IisGroup" Value="IIS_WPG" />
<CustomAction Id="SetIisSiteUser" Property="IisSiteUser" Value="[APP_USER_DOMAIN]\[APP_USER_NAME]"/>
<InstallExecuteSequence>
<Custom Action="SetIisGroupToIUSRS" After="AppSearch">IISMAJORVERSION>="#7"</Custom>
<Custom Action="SetIisGroupToWPG" After="AppSearch">IISMAJORVERSION="#6"</Custom>
<Custom Action="SetIisSiteUser" Before="InstallInitialize">1</Custom>
</InstallExecuteSequence>

Related

Wix MSI Installer:How to allow anonymous authentication when set to override="deny" in applicationHost.Config

I have a web application that we install via a Wix MSI project. The web.config includes the authentication nodes below. Everything installs correctly but after installation, I get the error message:
"The configuration section cannot be used at this path". This is due to the configuration locking in applicationHost.config .
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="true" />
<windowsAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
How can I override the applicationHost.config settings during the installation? I do install required Windows Features during the install, but am I missing one?
This is the solution that worked for me, calling appcmd from a custom action, before InstallFinalize.
<CustomAction Id="UnlockAnonymousAuthentication"
Execute="deferred"
Impersonate="no"
Return="check"
Directory="TARGETDIR"
ExeCommand="[SystemFolder]inetsrv\appcmd unlock config /section:anonymousAuthentication" />
<CustomAction Id="UnlockBasicAuthentication"
Execute="deferred"
Impersonate="no"
Return="check"
Directory="TARGETDIR"
ExeCommand="[SystemFolder]inetsrv\appcmd unlock config /section:basicAuthentication" />
<CustomAction Id="UnlockWindowsAuthentication"
Execute="deferred"
Impersonate="no"
Return="check"
Directory="TARGETDIR"
ExeCommand="[SystemFolder]inetsrv\appcmd unlock config /section:windowsAuthentication" />
<InstallExecuteSequence>
<Custom Action="UnlockAnonymousAuthentication" Before="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
<Custom Action="UnlockBasicAuthentication" Before="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
<Custom Action="UnlockWindowsAuthentication" Before="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>
Hope this helps someone.
Here is currently a way to do this directly using the WiX IIS extension WebDirProperties element:
https://wixtoolset.org/documentation/manual/v3/xsd/iis/webdirproperties.html
Something similar to this should work. Notice the critical piece is the WebDirProperties
element that specifies the
AnonymousAccess="yes" BasicAuthentication="no" WindowsAuthentication="no" which modify
the IIS properties you are looking to change during installation.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension" >
<Fragment>
<!-- Install to default web site -->
<iis:WebSite Id="DefaultWebSite" Description='Default Web Site'>
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
<!-- References the installation folder specified in the Product.wxs file under the INSTALLFOLDER -->
<DirectoryRef Id="WEB_INSTALLFOLDER">
<!-- Configure virtual dir -->
<Component Id="VirtualDirectoryComponent"
Guid="{INSERT-YOUR-OWN-GUID-2C27-427A-A7B1-DA4DBCC79117}"
KeyPath="yes" >
<iis:WebVirtualDir Id="VirtualDirectory"
Alias="[WEB_DIRECTORY_ALIAS]" Directory="WEB_INSTALLFOLDER"
WebSite="DefaultWebSite">
<iis:WebDirProperties Id="VirtualDirectoryProperties"
AnonymousAccess="yes" BasicAuthentication="no"
WindowsAuthentication="no" />
<iis:WebApplication
Id="MyWebApplication"
Name="MyWebApplication" />
</iis:WebVirtualDir>
</Component>
</DirectoryRef>
</Fragment>
</Wix>

wix installer / Create web-site and assign the new or exisiting web app pool

i try create a new web-site using wix installation. it's ok there is no problem but i cannot assign a new or existing web app pool to new web-site. iis:website tag does not contains WebAppPool attribute. How can i assign web app pool to web-site. You can see my code bellow.
thanks for helping.
<Component Id="WEB_SITE_CONFIGURE_COMPONENT" Guid="{35087032-D049-48C8-BCAD-1FEFD0C06A25}" NeverOverwrite="yes" Shared="yes" Permanent="yes" Transitive="yes">
<Condition><![CDATA[WEBSITE_INSTALLTYPE<>2]]></Condition>
<CreateFolder Directory="WEBSITE_FOLDER"/>
<iis:WebSite Id="WEB_SITE" Description="[WEBSITE_NAME]" SiteId="*" Directory="WEBSITE_FOLDER" ConfigureIfExists="yes" AutoStart="yes" StartOnInstall="yes">
<iis:WebAddress Id="AllUnassigned" Port="[WEBSITE_PORT]" />
</iis:WebSite>
<RegistryValue Root="HKLM" Key="$(var.DefaultRegistryKey)" Name="ConfigSite" Value="1" Type="string"></RegistryValue>
</Component>
<Component Id="WEBAPP_POOL_CONFIGURE_COMPONENT" Guid="{316738A6-26A2-4C14-9AB9-B2066E3FA288}" KeyPath="yes" Permanent="yes" Transitive="yes">
<Condition><![CDATA[(WEBSITE_INSTALLTYPE=0) OR (USE_CUSTOM_WEBSITE_FOLDER=1)]]></Condition>
<iis:WebAppPool Id="APP_POOL" Name="[WEBAPP_POOL_NAME]" ManagedPipelineMode="Classic" ManagedRuntimeVersion="v4.0"/>
<RegistryValue Root="HKLM" Key="$(var.DefaultRegistryKey)" Name="ConfigPool" Value="1" Type="string"></RegistryValue>
</Component>
<Component Id="WEPAPP_CONFIGURE_COMPONENT" Guid="{F95B024E-B6B6-4E6C-AC35-9B1086FC3521}" Transitive="yes">
<Condition><![CDATA[(WEBSITE_INSTALLTYPE<>2) AND ((WEBSITE_INSTALLTYPE=0) OR (USE_CUSTOM_WEBSITE_FOLDER=1))]]></Condition>
<iis:WebVirtualDir Id="VIRTUAL_DIR" Alias="[WEB_APP_NAME]" Directory="WWW_FOLDER" WebSite="WEB_SITE">
<iis:WebApplication Id="WEB_APP" Name="[WEB_APP_NAME]" WebAppPool="APP_POOL"/>
</iis:WebVirtualDir>
<RegistryValue Root="HKLM" Key="$(var.DefaultRegistryKey)" Name="ConfigVirtualDir" Value="1" Type="string"></RegistryValue>
</Component>
With the help of the following articles I have come up with a working installer in which a new AppPool can be created or an existing AppPool can be selected.
Creating a Web Application Installer with WIX 3.5 and Visual Studio 2010–Part 1
Web Application Installer in WiX
WiX and DTF: Using a Custom Action to list available web sites on IIS
Installing a Web Application to an Existing IIS Website using Wix3
In short:
Create a Website element in your Product element:
<Product>
<iis:WebSite Id="SelectedWebSite" Description="[WEBSITE_DESCRIPTION]" Directory="INSTALLFOLDER" SiteId="[WEBSITE_ID]">
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
</Product>
Create an Include WebSites.wxi with the following content:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<Property Id="WEBSITE_DESCRIPTION">
<RegistrySearch Id="WebSiteDescription" Name="WebSiteDescription" Root="HKLM" Key="SOFTWARE\!(loc.CompanyName)\[ProductName]\Install" Type="raw" />
</Property>
<Property Id="WEBSITE_ID">
<RegistrySearch Id="WebSiteID" Name="WebSiteID" Root="HKLM" Key="SOFTWARE\!(loc.CompanyName)\[ProductName]\Install" Type="raw" />
</Property>
<Property Id="WEBSITE_PATH">
<RegistrySearch Id="WebSitePath" Name="WebSitePath" Root="HKLM" Key="SOFTWARE\!(loc.CompanyName)\[ProductName]\Install" Type="raw" />
</Property>
<Property Id="WEBSITE_VD">
<RegistrySearch Id="WebSiteVD" Name="WebSiteVD" Root="HKLM" Key="SOFTWARE\!(loc.CompanyName)\[ProductName]\Install" Type="raw" />
</Property>
<CustomTable Id="AvailableWebSites">
<Column Id="WebSiteID" Category="Identifier" PrimaryKey="yes" Type="int" Width="4"/>
<Column Id="WebSiteDescription" Category="Text" Type="string" PrimaryKey="no"/>
<Column Id="WebSitePath" Category="Text" Type="string" PrimaryKey="no" Nullable="yes"/>
<Row>
<Data Column="WebSiteID">0</Data>
<Data Column="WebSiteDescription">Dummy</Data>
<Data Column="WebSitePath"></Data>
</Row>
</CustomTable>
</Include>
Create the CustomAction described here.
Create a wxs file with your AppPool:
<?xml version="1.0" encoding="UTF-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Fragment>
<Component Id="WebVirtualDirComponent" Guid="PUT-GUID-HERE" Directory="INSTALLFOLDER" KeyPath="yes">
<iis:WebAppPool
Id="YourAppPoolName"
Name="[VD][WEBSITE_ID]"
ManagedRuntimeVersion="v4.0"
IdleTimeout="0"
RecycleMinutes="0"
ManagedPipelineMode="integrated"/>
<iis:WebVirtualDir Id="VDir" Alias="[VD]" Directory="INSTALLFOLDER" WebSite="SelectedWebSite">
<iis:WebApplication Id="NotizBrowserWebApp" WebAppPool="YourAppPoolName" Name="[VD][WEBSITE_ID]" />
<iis:WebDirProperties Id="NotizBrowserProps" AnonymousAccess="no" WindowsAuthentication="yes" DefaultDocuments="-" Execute="yes" Script="yes" Read="yes"/>
</iis:WebVirtualDir>
</Component>
</Fragment>
</Wix>
Late answer, but hopefully someone will be benefited with this.
You don't need a CustomAction to make this work.
It is simple like this:
<Component Id="WebSite" Guid="PUT-YOUR-GUID-HERE">
<CreateFolder/>
<iis:WebSite Id="WebSite" Directory="WebSiteRoot" Description="[WEBSITEDESCRIPTION]" >
<iis:WebApplication Id="WebSiteApplication" Name="[WEBSITEDESCRIPTION]" WebAppPool="MyAppPool" />
</iis:WebSite>
<iis:WebAppPool Id="MyAppPool" Name="[APPPOOLNAME]" ManagedRuntimeVersion="v4.0"/>
</Component>
You need to update the "Internal" WebApplication of the WebSite.
You don't need to have the "WebSite Description" and "WebApplication Name" equal, but that will help you to understand what is going on.

how to fix warning ICE39: Admin Image flag set in SummaryInfo stream

I am creating an installer using Wix in visual studios 2012. Below is my code for the product.wxs. I am receiving a "warning ICE39: 'Admin Image' flag set in SummaryInfo stream. Should be set only for Admin packages." I have changed admin image from yes to no and rebuilt, it removes the warning but i am still unable to install on a computer that has local admin privileges, and is also a domain admin. However, i can install it on my machine, and im not a domain admin,
I would upload the image but not enough rep yet. here is an image link.
http://i656.photobucket.com/albums/uu290/chrizbahr/warning_zps12f388b2.png
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductName="CHC Pedometer Sync"?>
<?define ProductVersion="1.0.0"?>
<?define ProductGUID="{6D234D2C-5F74-42A8-A9DA-14D684B2EAFC}"?>
<?define ProductUpgradeCode="{DDDD43E0-DB34-4AD6-BF54-F6B12509E84F}"?>
<?define Manufacturer="CHC Wellness"?>
<Product Id="$(var.ProductGUID)"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.ProductUpgradeCode)">
<Package Id="*"
Description="CHC Pedometer Sync Installer"
Keywords="Installer"
Manufacturer="$(var.Manufacturer)"
SummaryCodepage="1252"
InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
AdminImage="yes"
InstallPrivileges="limited" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<!--DIRECTORY STRUCTURE-->
<Directory Id="TARGETDIR" Name="SourceDir">
<!--PROGRAM FILES-->
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="CHCWellness" Name="CHC Wellness">
<Directory Id="INSTALLDIR" Name="$(var.ProductName)" />
</Directory>
</Directory>
<!--DESKTOP-->
<Directory Id="DesktopFolder" Name="Desktop"/>
<!--START MENU-->
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$(var.Manufacturer)" />
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id="MainExecutable" Guid="{FB74004F-F250-4B3C-B38C-D96D5657A27A}">
<File Id="File_MainExecutable" Source="..\PedometerSync\bin\Release\PedometerSync.exe" Vital="yes" DiskId="1" KeyPath="yes">
<Shortcut Id="MainExeShortcutDesktop"
Name="$(var.ProductName)"
Directory="DesktopFolder"
Description="$(var.ProductName)"
WorkingDirectory="INSTALLDIR"
Advertise="yes"
Icon="icon.ico" />
</File>
</Component>
<Component Id="InterfaceExe" Guid="{68C78DE2-BEBB-41D7-B9F6-313BCFC88F68}">
<File Id="PedometerInterfaceEXE" Source="..\PedometerSync\bin\Release\PedometerInterface.exe" Vital="yes" DiskId="1" KeyPath="yes" />
</Component>
<Component Id="EXEConfig" Guid="{8D9F2744-C1E4-45E1-88E7-C3427200767E}">
<File Id="File_ExeConfigFile" Source="..\PedometerSync\bin\Release\PedometerSync.exe.config" Vital="yes" DiskId="1" KeyPath="yes" />
</Component>
<Component Id="Newtonsoft" Guid="{09343B58-A247-4AA9-9A32-A6CB1BD9CC2F}">
<File Id="file_newtonsoft.json.dll" Source="..\PedometerSync\bin\Release\Newtonsoft.Json.dll" Vital="yes" DiskId="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<!--SHORTCUTS-->
<DirectoryRef Id="ProgramMenuDir">
<Component Id="StartMenuShortcut" Guid="{E02282A4-0907-4EC6-A5B7-623E50B4E642}">
<Shortcut Id="MainExeShortcut"
Name="$(var.ProductName)"
Description="$(var.ProductName)"
Target="[INSTALLDIR]PedometerSync.exe"
Icon="icon.ico"/>
<RemoveFolder Id="RemoveStartMenuShortcutDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<!--FEATURES LIST-->
<Feature Id="Standard" Level="1">
<ComponentRef Id="MainExecutable"/>
<ComponentRef Id="InterfaceExe"/>
<ComponentRef Id="EXEConfig"/>
<ComponentRef Id="Newtonsoft"/>
<ComponentRef Id="StartMenuShortcut"/>
</Feature>
<!--ADD UI ELEMENTS-->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_InstallDirCustom" />
<UIRef Id="WixUI_ErrorProgressText" />
<!--CUSTOM IMAGES-->
<WixVariable Id="WixUIBannerBmp" Value="banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="dialog.bmp" />
<!--ICONS-->
<Icon Id="icon.ico" SourceFile="icon.ico" />
</Product>
</Wix>
Remove the Admin attribute. This attribute doesn't refer to needing admin rights to install a package, it refers to whether the MSI is a normal Installation or an Administrative Installation.
For more information, see the help topics:
Administrative Installation (Windows)
Word Count Summary property (Windows) (Notice the definition of bit 2 and bit 3 these correlate to the AdminImage and InstallPrivileges attributes respectively)

wix virtual directories under default web site not uninstalled, conflict with other features?

I am building an installer using wix for several .net web applications. I have two features, one of which installs several virtual directories / applications under default web site in IIS. The second feature creates a separate website with a single virtual directory.
The problem is when I install both features, the virtual directories (from feature 1) under default web site are not removed during the uninstall. The strange part is that if I just install feature 1 (exclude feature 2) the uninstall works properly for feature 1 and the virtual directories are removed.
I am new to wix, I'm guessing something is wrong with my product.wxs or there is something Im not understanding. Thoughts?
Here is a sample snippet from my product.wxs file :
<Feature Id="feature1" Title="feature1" Description="feature 1 description" Level="1" ConfigurableDirectory="INSTALLDIR" Display="expand">
...
<ComponentGroupRef Id="IIS_Feature1" />
</Feature>
<Feature Id="feature2" Title="feature2" Description="feature 2 description" Level="1" ConfigurableDirectory="INSTALLDIR" Display="expand">
...
<ComponentGroupRef Id="IIS_Feature2" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
...
<Directory Id="ROOT_DRIVE">
<Directory Id="Inetpubdir" Name="inetpub">
<Directory Id="wwwrootdir" Name="wwwroot" />
<Directory Id="wwwrootcustom" Name="wwwroot-custom" />
</Directory>
</Directory>
</Directory>
<ComponentGroup Id="IIS_Feature1">
<Component Id="IIS_WebApp1" Guid="some-guid-1" Directory="wwwrootdir" KeyPath="yes">
<iis:WebVirtualDir Id="WebApp1VirtualDir" Alias="webapp1" WebSite="DefaultWebSite" Directory="WEBAPP1DIR">
<iis:WebApplication Id="WebApp1IISApplication" Name="webapp1" />
</iis:WebVirtualDir>
</Component>
<Component Id="IIS_WebApp2" Guid="some-guid-2" Directory="wwwrootdir" KeyPath="yes">
<iis:WebVirtualDir Id="WebApp2VirtualDir" Alias="webapp2" WebSite="DefaultWebSite" Directory="WEBAPP2DIR">
<iis:WebApplication Id="WebApp2IISApplication" Name="webapp2" />
</iis:WebVirtualDir>
</Component>
<Component Id="IIS_WebApp3" Guid="some-guid-3" Directory="wwwrootdir" KeyPath="yes">
<iis:WebVirtualDir Id="WebApp3VirtualDir" Alias="webapp3" WebSite="DefaultWebSite" Directory="WEBAPP3DIR">
<iis:WebApplication Id="WebApp3IISApplication" Name="webapp3" />
</iis:WebVirtualDir>
</Component>
</ComponentGroup>
<ComponentGroup Id="IIS_Feature2">
<Component Id="IIS_WebApp4" Guid="some-guid-4" Directory="wwwrootcustom" KeyPath="yes">
<iis:WebSite Id="WebApp4Site" Description="Web App 4 Site" Directory="wwwrootcustom" AutoStart="yes">
<iis:WebVirtualDir Id="WebApp4VirtualDir" Alias="webapp4" Directory="WEBAPP4DIR">
<iis:WebApplication Id="WebApp4IISApplication" Name="webapp4" />
</iis:WebVirtualDir>
<iis:WebAddress Id="WebApp4SiteAddr" Secure="yes" Port="443"/>
</iis:WebSite>
</Component>
</ComponentGroup>
This issue was discovered during early development of my installer. As more development work was done and other issues resolved, I am no longer seeing this behavior.
I never really figured out exactly what was happening, but I have noticed during testing if one or more things are awry with the installer, certain (seemingly unrelated) components will be left behind during the uninstall...

How to add condition in component?

My requirement is to add below mentioned scenarios in same installer.
Create a virtual directory under default web site if IIS version is 5.1
Create a new web site if IIS version is equal to or greater than 6.
I added code as given below but it is not working.
<DirectoryRef Id="ServDir">
<Directory Id="ServerWebDIR" Name="$(var.Manufacturer_WWW_LONG_DIRNAME)">
<Component Id="$(var.ServerWeb_Id)" Guid="$(var.ServerWeb_Component_GUID)">
<File Id="FLSW_admin.html" DiskId="1" Name="admin.html" Source="$(var.SERVER_wwwDir)admin.html" />
<RemoveFolder Id="FLSW_admin.html On="uninstall" />
</Component>
</Directory>
<Component Id="TestWebVirtualDirComponent" Guid="{F509D5DC-3F13-4AAF-974E-0D7EF82EE4B2}">
<Condition>IISMAJORVERSION = "#5"</Condition>
<CreateFolder/>
<iis:WebVirtualDir Id="WebDir" Alias="$(var.VirtualDirAlias)" Directory="ServerWebDIR" WebSite="DefaultWebSite" DirProperties="WebDirProperty">
<iis:WebApplication Id="TestWebApplication" Name="$(var.VirtualDirAlias)"/>
</iis:WebVirtualDir>
</Component>
<Component Id="WebSite" Guid="{F509D5DC-3F13-4AAF-974E-0D7EF82EE4B3}">
<Condition>IISMAJORVERSION >= "#6"</Condition>
<CreateFolder />
<iis:WebSite Id="WebSiteFolder" Description="$(var.EnterpriseWebSiteDescription)" Directory='ServerWebDIR'>
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
</Component>
</DirectoryRef>
<iis:WebDirProperties Id="WebDirProperty" Execute="yes" Script="yes" Read="yes" />
<iis:WebDirProperties Id="WebDirPropertyForbidExecution" Execute="no" Script="yes" Read="yes" />
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site" >
<iis:WebAddress Id="AllUnassigned1" Port="80" />
</iis:WebSite>
What is the problem with my code. Please anyone suggests that how to achieve my requirement in same installer?

Resources