2019年11月23日土曜日

いろいろ入ったWixプロジェクト

リポジトリはこちらから
https://dev.azure.com/ZioLuigi/CADKhanOpen/_git/CADKhanOpen?path=%2FSetupProject1&version=GBmaster
Wix は MSI を作成するツールです。
https://wixtoolset.org/ からダウンロードできます。
Wix Toolset Visual Studio Extension をインストールすると、Visual Studio での Wix がさらに使いやすくなります。

ファイルメニューの新規作成、プロジェクトから新しいプロジェクト ダイアログボックスを開きます。Wix Toolset がインストールされていれば下記のプロジェクトが表示できます。

Setup Project は、MSI ファイルを作成するプロジェクトで必須です。
Custom Action Project は、MSI ファイルによるインストール操作中に MSI が提供している機能ではできない、できても面倒な処理を C# コードで実行できるようにするものです。
Bootstrapper Project は、EXE ファイルのインストーラーを作成するプロジェクトです。

Setup Project や Custom Action Project を選択すると、C#やC++プロジェクトと同様に、スケルトンコードを生成します。

Project.wxs

自動生成された Project.wxs は次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="" UpgradeCode="6026552e-9a7e-441e-9c0e-1aa502fac236">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />

<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject1" />
</Directory>
</Directory>
</Fragment>

<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
</ComponentGroup>
</Fragment>
</Wix>

最低限必要な作業は次の通り。

  1. ProductタグのManifacture属性に会社/組織名を入力
  2. Componentタグのコメントを除去
  3. ComponentタグにGuid 属性を追加して、Guid を新規作成して追加
  4. Componentタグに、File タグを追加してインストールするファイルを追加。TextFile1.txt を用意する。
  5. 以上で C:\Program Files\SetupProject1 フォルダを作成し、TextFile1.txt をインストールするMSIファイルが作成できる

色々入った部分

こんな機能が追加されています。

  • セットアップウィザードを表示する
  • 機能が選択できる
  • ライセンスのページを表示させない
  • 管理者権限で起動する DLL タイプのカスタムアクションにパラメータを与える
  • DLL タイプのカスタムアクションを管理者権限で起動する
  • EXE タイプのカスタムアクションを管理者権限で起動する


異尺度注釈図形にアタッチされている尺度を知る

 異尺度注釈図形が持っている尺度(文字列)を表示する ;;; ;;; LISTANNOSCALE.LSP ;;; (defun C:LISTANNOSCALE ( / el id f)   (setq f T)   ;異尺度注釈図形を選択   (if (setq el (entg...