Add UI to an Installer

系统 1431 0

接上回说道 ,那个太简单的Installer安装起来太快了...一闪而过,用户顶多看到个Title,其他的什么都看不到,更别说参与:这是个问题,很大的问题,总得告诉用户他正在装的是啥东东,装些什么,装的时候是个什么状态或者进度!我们又不是流氓软件~

 

那怎么给installer加上UI呢?很简单:

UI Wizardry
代码
<? xml version="1.0" encoding="UTF-8" ?>
< Wix  xmlns ="http://schemas.microsoft.com/wix/2006/wi" >
    
< Product  Id ="e6ecf2a7-b03c-4b3f-ace8-6179ab62e4c7"  Name ="WixProject"  Language ="1033"  Version ="1.0.0.0"  Manufacturer ="WixProject"  UpgradeCode ="b3d503b8-4f21-4116-8562-6ff1e0e16a28" >
        
< Package  InstallerVersion ="200"  Compressed ="yes"   />

        
< Media  Id ="1"  Cabinet ="media1.cab"  EmbedCab ="yes"   />

        
< Directory  Id ="TARGETDIR"  Name ="SourceDir" >
            
< Directory  Id ="ProgramFilesFolder" >
                
< Directory  Id ="INSTALLLOCATION"  Name ="WixProject" >
                    
<!--  TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer.  -->
                     
< Component  Id ="ProductComponent"  Guid ="266b1212-45bf-4b65-a31a-29c3bdc43e20" >
             
< File  Id ="WindowsFormsApplication"  Source ="$(var.SolutionDir)\WindowsFormsApplication\$(var.OutDir)\WindowsFormsApplication.exe"   />
                     
</ Component >  
                
</ Directory >
            
</ Directory >
        
</ Directory >

        
< Feature  Id ="ProductFeature"  Title ="WixProject"  Level ="1" >
            
<!--  TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer.  -->
             
< ComponentRef  Id ="ProductComponent"   />  
        
</ Feature >

    
< UIRef  Id ="WixUI_Mondo" />
    
    
</ Product >
</ Wix >

关键就在那句:

< UIRef  Id ="WixUI_Mondo" />

 

还没完:

继续 1) Add Reference...,给WixProject加上WixUIExtension (C:\Program Files\Windows Installer XML v3\bin\WixUIExtension.dll)
Add UI to an Installer

2) 编译,纠错,最后打开$(SolutionDir)\WixProject\$(OutDir)\WixProject.msi测试!

3) 看到UI了吧,是不是比以前用户体验好一点儿了?只可惜...不能指定安装目录,甚至没机会给我们选择!
Add UI to an Installer
欢迎界面
Add UI to an Installer
协议界面
Add UI to an Installer
安装界面
Add UI to an Installer
安装结束界面

4) 而且那个License和那些Icon貌似都不是我们想要的,以后得把他们一一替换掉!

 

不仅仅这些,WixUIExtension还给我们提供了更多选择:

< Property  Id ="WIXUI_INSTALLDIR"  Value ="INSTALLLOCATION"   />
< UIRef  Id ="WixUI_InstallDir" />
注意 1) < Property  Id ="WIXUI_INSTALLDIR"  Value ="INSTALLLOCATION"   /> 是必须要的,否则会产生Error,就在跳到那个"选择安装目录"的UI前.
2) 不能同时添加两个 UIRef ,会出错的!
Add UI to an Installer
目标文件夹界面


还有3个,自己试试看吧~

< UIRef  Id ="WixUI_FeatureTree"   />
< UIRef  Id ="WixUI_Minimal"   />
< Property  Id ="ApplicationFolderName"  Value ="WiX Sample Application"   />
< Property  Id ="WixAppFolder"  Value ="WixPerUserFolder"   />
< UIRef  Id ="WixUI_Advanced"   />


声明这几个变量,可以实现替换自定义的License,Banner和Icon,我这里就不演示了~
WixVariable
< WixVariable  Id ="WixUILicenseRtf"  Value ="Media\License.rtf"   />
< WixVariable  Id ="WixUIBannerBmp"  Value ="Media\banner.bmp"   />
< WixVariable  Id ="WixUIDialogBmp"  Value ="Media\dialog.bmp"   />
< WixVariable  Id ="WixUIExclamationIco"  Value ="Media\exclamation.ico"   />
< WixVariable  Id ="WixUIInfoIco"  Value ="Media\information.ico"   />
< WixVariable  Id ="WixUINewIco"  Value ="Media\new.ico"   />
< WixVariable  Id ="WixUIUpIco"  Value ="Media\up.ico"   />


OK,如果你每个都试做了,是不是立即会感觉到原来依旧太简单啦!?

建议大家再试试,从UI上进行Repair/Remove,再从appwiz.cpl或者右键MSI进行修复/卸载~
Add UI to an Installer

Add UI to an Installer


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论