我使用WiX创建一个ASP.Net网站的安装程序。如何使用WiX在IIS中设置ASP.Net版本?
解决方法
我们使用这个:
首先从注册表确定.Net框架的根目录:
<Property Id="FRAMEWORKROOT"> <RegistrySearch Id="FrameworkRootDir" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework" Type="directory" Name="InstallRoot" /> </Property>
然后,在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,POST" /> <iis:WebApplicationExtension Extension="svc" CheckPath="no" Script="yes" Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll" Verbs="GET,POST" /> </iis:WebApplication> </iis:WebVirtualDir> </Component>
对于x64安装程序(这是重要)
添加Win64 =’yes’到注册表搜索,因为64位机器上的32位环境有一个不同的注册表配置单元(和一个不同的frameworkroot)
<RegistrySearch Id="FrameworkRootDir" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework" Type="directory" Name="InstallRoot" Win64='yes' />