I am creating an installer for an ASP.Net website using WiX. How do you set the ASP.Net version in IIS using WiX?
We use this:
First determine the .Net framework root directory from the registry:
<Property Id="FRAMEWORKROOT">
<RegistrySearch Id="FrameworkRootDir" Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework"
Type="directory" Name="InstallRoot" />
</Property>
Then, inside the component that installs your website in IIS:
<!-- Create and configure the virtual directory and application. -->
<Component Id='WebVirtualDirComponent' Guid='{GUID}' Permanent='no'>
<iis:WebVirtualDir Id='WebVirtualDir' Alias='YourAlias' Directory='InstallDir' WebSite='DefaultWebSite' DirProperties='DirProperties'>
<iis:WebApplication Id='WebApplication' Name='YourAppName' WebAppPool='AppPool'>
<!-- Required to run the application under the .net 2.0 framework -->
<iis:WebApplicationExtension Extension="config" CheckPath="yes" Script="yes"
Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,HEAD,POST" />
<iis:WebApplicationExtension Extension="resx" CheckPath="yes" Script="yes"
Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,HEAD,POST" />
<iis:WebApplicationExtension Extension="svc" CheckPath="no" Script="yes"
Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,HEAD,POST" />
</iis:WebApplication>
</iis:WebVirtualDir>
</Component>
For an x64 installer (THIS IS IMPORTANT) Add Win64='yes' to the registry search, because the 32 bits environment on a 64 bits machine has a different registry hive (and a different frameworkroot)
<RegistrySearch Id="FrameworkRootDir" Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework"
Type="directory"
Name="InstallRoot" Win64='yes' />