zoukankan      html  css  js  c++  java
  • MSI windows程序安装

    控制面板里只有一个版本号

    安装时采取升级方式,主要关键点有:
    1.版本更新;(1.1.1.XXXXX-> 1.1.2.XXXXX)
    2.ProductCode变化;(<Product Id="*")
    3.UpgradeCode保持不变。(<Upgrade Id="不变")

    自定义操作

    1.新建C# Custom Action Project for WiX动态库;
    2.Setup Project for WiX添加引用;
    3.XML编辑;

    <Binary Id="SetupCustomClass" SourceFile="$(var.MyInstallerCustomAction.TargetDir)$(var.MyInstallerCustomAction.TargetName).CA.dll" />
    <CustomAction BinaryKey="SetupCustomClass" Id="CustomClassMethod1" DllEntry="CustomClassMethod1" />
    <InstallExecuteSequence>
          <Custom Action="CustomClassMethod1" After="InstallInitialize"></Custom>
    </InstallExecuteSequence>
    

    CustomClassMethod1里可以直接访问相关属性,比如session["INSTALLFOLDER"]获取安装目录。

    自定义操作传递参数

    <CustomAction Id="FileRemainderMeasureBefore" Property="FileRemainderMeasure" Value="SomeCustomActionDataKey=$(var.MyClientProject.TargetName)|[INSTALLFOLDER]|[APPLICATIONFOLDER]" />
    <CustomAction BinaryKey="SetupCustomClass" Id="FileRemainderMeasure" DllEntry="FileRemainderMeasure" Execute="deferred" Return="check" HideTarget="no" Impersonate="no" />
    <InstallExecuteSequence>
          <Custom Action="FileRemainderMeasureBefore" Before="FileRemainderMeasure"></Custom>
          <Custom Action="FileRemainderMeasure" Before="InstallFinalize">REMOVE="ALL"</Custom>
    </InstallExecuteSequence>
    

    FileRemainderMeasure方法里,可以在卸载后获取传递的参数,作彻底清理等操作。

    string data = session.CustomActionData["SomeCustomActionDataKey"];
    

    因为是延迟操作,当前session不能访问。

    InstallExecuteSequence

    Installer会按照默认顺序来执行

    • AppSearch
    • LaunchConditions
    • ValidateProductId
    • CostInitialize
    • FileCost
    • CostFinalize
    • InstallValidate
    • **InstallInitialize**
    • ProcessComponents
    • UnpublishFeatures
    • RemoveRegistryValues
    • RemoveShortcuts
    • RemoveFiles
    • InstallFiles
    • CreateShortcuts
    • WriteRegistryValues
    • RegisterUser
    • RegisterProduct
    • PublishFeatures
    • PublishProduct
    • **InstallFinalize**
    

    MSI调试日志

    cmd中输入指令:

    MSIEXEC /I  "AbsoluteDirHHT.EOCInstaller_dev.msi" /L*v "AbsoluteDirInstallLog.txt"
    
  • 相关阅读:
    Redis实战(十)Redis常见问题及解决方案
    小团队构建大网站:中小研发团队架构实践
    Asp.net core 3.0
    图解TCP/IP
    TCP/IP协议
    Grid画边框
    WPF常用方法,事件驱动和控件遍历
    WPF中的画图
    WPF中的常用类汇总:
    WPF中的VisualTreeHelper
  • 原文地址:https://www.cnblogs.com/wesson2019-blog/p/14344720.html
Copyright © 2011-2022 走看看