Wix制作安装包

Wix制作安装包,找起资料来很费劲,记录一下:

 

Product.wxs,该文件只能制作出msi形式的安装包,不能做到自动检测framework。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
    <Product Id="{1F471579-CF71-4375-96ED-065093700642}" Name="云互通" Language='2052' Codepage='936' 
           Version="1.0.0.0" Manufacturer="Winway" UpgradeCode="DBAD34E4-EA8B-4DF6-970F-170E8011956F">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />
    <WixVariable Id="WixUIBannerBmp" Value="banner.bmp"/>
    <WixVariable Id="WixUIDialogBmp" Value="dialog.bmp"/>
    <WixVariable Id="WixUILicenseRtf" Value="licence.rtf"/>
    
    <Property Id="ARPNOREPAIR" Value="yes" Secure="yes"/> 
    
    <!--TARGETDIR这是一个虚拟的dir,用于包含其它的Directory-->
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="DesktopFolder" Name="Desktop" />

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="云互通" ></Directory>
      </Directory>

      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLLOCATION" Name="Winway">
          <Directory Id="Resource" Name="Resource"></Directory>
        </Directory>
      </Directory>
      
    </Directory>
      
    <ComponentGroup Id="help">
      <Component Id="uninstall" Guid="{6886685C-E1B1-48d9-B6A7-548175BD8F17}" Directory="ProgramMenuDir">
        <Condition>
          <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
        </Condition>
        <Shortcut Id="UninstallProduct" Name="卸载云互通" Directory="ProgramMenuDir" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Description="Uninstall" Icon="uninstall.ico">
          <Icon Id="uninstall.ico" SourceFile="$(var.FCS.UI.TargetDir)Resource\uninstall.ico" />
        </Shortcut>
        <RemoveFolder Id='rmvProgramMenuDir' On='uninstall' />
        <RegistryValue Root='HKCU' Key='Software/[Manufacturer]/[ProductName]' Type='string' Value='' KeyPath='yes' />
      </Component>
      
      <Component Id="FCS.Service" Guid="{53E2898A-6BBB-4EC9-8455-E56200CD0A17}" Directory="INSTALLLOCATION">
        <File Source="$(var.FCS.Service.TargetPath)" KeyPath="yes" DiskId="1" />
        <File Source="$(var.FCS.Service.TargetDir)setting.config" />
        <File Source="$(var.FCS.Service.TargetDir)log4net.dll" />
        <File Source="$(var.FCS.Service.TargetDir)log4net.config" />
        <File Source="$(var.FCS.Service.TargetDir)FCS.BLL.dll" />
        <File Source="$(var.FCS.Service.TargetDir)FCS.Model.dll" />
        <File Source="$(var.FCS.Service.TargetDir)FCS.Util.dll" />
        <File Source="$(var.FCS.Service.TargetDir)Newtonsoft.Json.dll" />
        <File Source="$(var.FCS.Service.TargetDir)Ionic.Zip.dll" />
        <File Source="$(var.FCS.Service.TargetDir)Oracle.ManagedDataAccess.dll" />
        <File Source="$(var.FCS.Update.TargetPath)" />
        <ServiceInstall Id="ServiceInstaller"
                        Type="ownProcess"
                        Vital="yes"
                        Name="FCS"
                        DisplayName="FCS 2.0"
                        Description="深圳万威科技有限公司云互通 V2.0"
                        Start="auto"
                        Account="LocalSystem"
                        ErrorControl="ignore"
                        Interactive="no" />
        <ServiceControl Id="StartService"
                        Start="install"
                        Stop="both"
                        Remove="uninstall"
                        Name="FCS"
                        Wait="yes" />
      </Component>
      
      <Component Id="FCS.UI" Guid="{D61B7439-25A8-4C28-8F74-64ADE3AC183B}" Directory="INSTALLLOCATION">
        <File Source="$(var.FCS.UI.TargetPath)">
          <Shortcut Id="startmenu" Directory="ProgramMenuDir" Name="参数设置"  WorkingDirectory='INSTALLLOCATION' Advertise="yes" Icon="start.ico">
            <Icon Id="start.ico" SourceFile="$(var.FCS.UI.TargetDir)Resource\FCS.UI.ico" />
          </Shortcut>
          <Shortcut Id="desktop" Directory="DesktopFolder" Name="云互通"  WorkingDirectory='INSTALLLOCATION' Advertise="yes"  Icon="start.ico" />
        </File>
      </Component>     

    </ComponentGroup>
    
    <Feature Id="ProductFeature" Level="1">
      <ComponentRef Id="FCS.Service" />
      <ComponentRef Id="FCS.UI" />
      <ComponentRef Id="uninstall" />
    </Feature>
    
    <PropertyRef Id="NETFRAMEWORK40FULL"/>

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />

    <UI>
      <UIRef Id="WixUI_InstallDir" />
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish> <!--隐藏license界面-->
      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
    </UI>    
  </Product>
</Wix>

界面定义文件,需要它的原因是界面整个用图片替代,所以要隐藏掉一些。

<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="zh-cn" Language='2052' Codepage='936'  xmlns="http://schemas.microsoft.com/wix/2006/localization">
  <String Id="WelcomeDlgTitle" Overridable="yes"></String>
  <String Id="WelcomeDlgDescription" Overridable="yes"></String>
  <String Id="FatalErrorTitle" Overridable="yes"></String>
  <String Id="FatalErrorDescription1" Overridable="yes"></String>
  <String Id="FatalErrorDescription2" Overridable="yes"></String>
  <String Id="UserExitTitle" Overridable="yes"></String>
  <String Id="UserExitDescription1" Overridable="yes"></String>
  <String Id="UserExitDescription2" Overridable="yes"></String>
  <String Id="MaintenanceWelcomeDlgDescription" Overridable="yes"></String>
  <String Id="MaintenanceWelcomeDlgTitle" Overridable="yes"></String>
  <String Id="ExitDialogDescription" Overridable="yes"></String>
  <String Id="ExitDialogTitle" Overridable="yes"></String>
</WixLocalization>

制作启动文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" 
    xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Bundle Name="云互通" Version="1.0.0.0" Manufacturer="Winway" UpgradeCode="7742af6f-d4a6-4d28-84d2-ec42fb1b220d"
    IconSourceFile="FCS.UI.ico">

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
      <bal:WixStandardBootstrapperApplication LicenseFile="E:\FCS\Client\Source\FCS2.0\FCS.Install\licence.rtf"
          LocalizationFile="MyLocalize.wxl" LogoFile="FCS.Logo.jpg" />
    </BootstrapperApplicationRef>  

        <Chain>
      <PackageGroupRef Id="NetFx40Web"/>
      <MsiPackage Id="FCS" SourceFile="E:\FCS\Client\Source\FCS2.0\FCS.Install\bin\Release\zh-cn\FCS.msi" DisplayInternalUI="yes"></MsiPackage>
    </Chain>
    </Bundle>
</Wix>

语言文件

<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="zh-cn" Language='2052' Codepage='936'  xmlns="http://schemas.microsoft.com/wix/2006/localization">
  <String Id="Caption">安装 [WixBundleName]</String>
  <String Id="Title">[WixBundleName]</String>
  <String Id="ConfirmCancelMessage">你想取消安装吗?</String>
  <String Id="HelpHeader">安装帮助</String>
  <String Id="HelpText">
    /install | /repair | /uninstall | /layout [directory] - 安装,修复,卸载或. 默认为安装操作.
    /passive | /quiet -  不显示任何界面和提示,默认状况下,用户和所有提示都会被显示出来。
    /norestart   - 安装过程中禁止启动。 默认情况下,界面会提示重新启动。
    /log log.txt - 日志记录成一个特殊的文件. 默认情况下,日志文件存在在系统TEMP文件夹中。
  </String>
  <String Id="HelpCloseButton">Close</String>
  <String Id="InstallAcceptCheckbox">我同意许可条款和条件</String>
  <String Id="InstallOptionsButton">选择项</String>
  <String Id="InstallInstallButton">安装</String>
  <String Id="InstallCloseButton">关闭</String>
  <String Id="OptionsHeader">安装选择项</String>
  <String Id="OptionsLocationLabel">安装位置 (不推荐安装在硬盘根目录):</String>
  <String Id="OptionsBrowseButton">浏览</String>
  <String Id="OptionsOkButton">确定</String>
  <String Id="OptionsCancelButton">取消</String>
  <String Id="ProgressHeader">安装进度</String>
  <String Id="ProgressLabel">进度:</String>
  <String Id="OverallProgressPackageText">初始化...</String>
  <String Id="ProgressCancelButton">取消</String>
  <String Id="ModifyHeader">选择安装类型</String>
  <String Id="ModifyRepairButton">修复</String>
  <String Id="ModifyUninstallButton">卸载</String>
  <String Id="ModifyCloseButton">关闭</String>
  <String Id="SuccessHeader">安装成功</String>
  <String Id="SuccessLaunchButton">运行</String>
  <String Id="SuccessRestartText">在使用软件之前,请先重启电脑。</String>
  <String Id="SuccessRestartButton">重启</String>
  <String Id="SuccessCloseButton">关闭</String>
  <String Id="FailureHeader">安装失败</String>
  <String Id="FailureHyperlinkLogText">一个或多个原因导致安装失败,请修复安装包或重试,更多原因请查看日志。</String>
  <String Id="FailureRestartText">你必须重启计算机才能完成软件的回滚操作</String>
  <String Id="FailureRestartButton">重启</String>
  <String Id="FailureCloseButton">关闭</String>
</WixLocalization>

 

posted @ 2016-12-15 17:20  Season2009  阅读(895)  评论(0编辑  收藏  举报