Wix Note (2)

1) Customize font style
<Fragment>
	<UI>
	    <TextStyle Id="CustomUI_Tips" Blue="22" Red="249" Green="195"  Italic="yes" FaceName="Tahoma" Size="8"/>
	    <Dialog Id="PoolSettingsDlg" Width="370" Height="270" Title="Application Pool Settings - [ProductName]" NoMinimize="yes">
<Control Id="Description" Type="Text" X="25" Y="23"  Width="280" Height="15" Transparent="yes" NoPrefix="yes">
	<Text>{\CustomUI_Tips}Please enter database configuration</Text>
</Control>
2) Check .net framework version
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
...
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0 full. Please install the .NET Framework then run this installer again.">
	<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
3) Check IIS Version
<!-- Check to see if IIS is installed. It it's not, error out. -->
<Property Id="IIS_MAJOR_VERSION">
	<RegistrySearch Id="CheckIISVersion"
					Root="HKLM"
					Key="SOFTWARE\Microsoft\InetStp"
					Name="MajorVersion"
				    Type="raw" />
</Property>
<Condition Message="IIS must be installed">
	Installed OR (IIS_MAJOR_VERSION >= "#7")
</Condition>
4) Check if MVC 4.0 installed
<!-- Check mvc version -->
<Property Id='ASPNETMVCVERSION'>
	<RegistrySearch Id='CheckMvcVersion'
					Type="raw"
					Root='HKLM'
					Key='SOFTWARE\Microsoft\ASP.NET\4.0.30319.0'
					Name='AssemblyVersion'/>
</Property>
<Condition Message='This application requires MVC 4.0. Please install MVC 4.0 then run this installer again.'>
	ASPNETMVCVERSION >= "4.0.0.0"
</Condition>
5) Modify xml File
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
...
<DirectoryRef Id="Client">
	<Component Id="ClientConfigCmp" Guid="{F14A9B5D-649A-4141-99B4-18C8E4DB7AD6}" KeyPath="yes" Feature="WebClient">
		<!-- Modify the connection string -->
		<util:XmlFile Id="ModifyClientConnStr" PreserveModifiedDate="yes" Permanent="yes"  SelectionLanguage="XSLPattern"
                 Action="setValue"
				 File='[INSTALLLOCATION]Client\Web.Config'
                 ElementPath="/configuration/connectionStrings/add[\[]@name='PatchDBEntities'[\]]"
                 Name="connectionString"
                 Value="[CONNECTION_STRING]"
                 Sequence="1" />
		<!-- Add current logon user as AdminUser -->
		<util:XmlFile Id="ModifyBuildInAdmin" PreserveModifiedDate="yes" Permanent="yes"  SelectionLanguage="XSLPattern"
			 Action="setValue"
			 File='[INSTALLLOCATION]Client\Web.Config'
			 ElementPath="/configuration/appSettings/add[\[]@key='BuiltInAdmins'[\]]"
			 Name="value"
			 Value="[WEB_APP_POOL_IDENTITY_DOMAIN]\[WEB_APP_POOL_IDENTITY_NAME]"
			 Sequence="1" />
		<!-- Modify end point address -->
		<util:XmlFile Id="ModifyEndpointAdress" PreserveModifiedDate="yes" Permanent="yes"  SelectionLanguage="XSLPattern"
				 Action="bulkSetValue"
				 File='[INSTALLLOCATION]Client\Web.Config'
				 ElementPath="/configuration/system.serviceModel/client/endpoint"
				 Name="address"
				 Value="http://localhost:[SERVICE_PORT_VAL]/PatchCreationService.svc"
				 Sequence="1" />
	</Component>
</DirectoryRef>
6) Create AppPool
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
...
<Fragment>
	
	<DirectoryRef Id="INSTALLLOCATION">
		<Component Id="PatchAppPoolCmp" Guid="{EC530DF7-6B33-4b1e-8BC2-08DD1F19C7F1}" KeyPath="yes">
			<util:User  Id="PatchAppPoolUser"
						CreateUser="no"
						Name="[WEB_APP_POOL_IDENTITY_NAME]"
						Password="[WEB_APP_POOL_IDENTITY_PWD]"
						Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]" />

			<iis:WebAppPool Id="PatchAppPool"
							ManagedPipelineMode="Integrated"
							ManagedRuntimeVersion="v4.0"
							Name="[WEB_APP_NAME]"
							Identity="other"
							User="PatchAppPoolUser" />
		</Component>
	</DirectoryRef>
</Fragment>
7) Create WebSite
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
...
<DirectoryRef Id="Client">
	<Component Id="PatchClient" Guid="{F217FC80-B8CF-455e-969D-9E6B0193F955}" KeyPath="yes">
		<iis:WebSite Id="PatchClient"
					 Description='[CLIENT_SITE_NAME_VAL]'
					 AutoStart='yes'
					 Directory='Client'
					 ConfigureIfExists='yes'>
			<iis:WebAddress Id="PatchClientAddress" Port="[CLIENT_PORT_VAL]" />
			<iis:WebApplication Id="PatchClientApp" Name="PatchClient" WebAppPool="PatchAppPool"/>					
			<iis:WebDirProperties Id="ClientWebDirProperties" AnonymousAccess="no" BasicAuthentication="no" WindowsAuthentication="yes"/>
		</iis:WebSite>
	</Component>
</DirectoryRef>
8) A messageBox Dialog sample
<Dialog Id="MessageBox" Width="320" Height="60" Title="Message" NoMinimize="yes">
	<Control Id="Return" Type="PushButton" X="140" Y="40" Width="56" Height="17" Default="yes" Cancel="yes" Text="Ok">
		<Publish Event="EndDialog" Value="Return">1</Publish>
	</Control>
	<Control Id="ConnError" Type="Text" NoWrap="no" X="15" Y="15" Width="300" Height="51" TabSkip="no" >
		<Text>[Message]</Text>
	</Control>
</Dialog>
9) Launch condition

 we check for some global settings and stop the installation if our conditions are not met. Just add this line to our previous sample somewhere not within a feature (for instance, between the Package and Media tags) and it will refuse to run if you're not an administrator on your machine.

<Condition Message="You need to be an administrator to install this product.">
	Privileged
</Condition>

many more properties like "Privileged".

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值