Wix:无法覆盖自定义操作

时间:2018-02-08 09:22:22

标签: wix

Wix工具集3.10

最后我设法为安装程序创建了一个简单的模拟窗口...但是我无法覆盖属性SxSFolder的默认值SXS_PATH ...

我在安装顺序中的构思:

  1. 在LicenseAgreementDlg之后,名为WindowsServerRolesAndFeaturesDlg的自定义对话框会产生。
  2. WindowsServerRolesAndFeaturesDlg中,用户可以浏览BrowseDlg以输入路径编辑TxtDir的资源管理器路径(id est property SXS_PATH覆盖)
  3. 在自定义窗口中按下一个按钮,一个CustomAction SetCustomActionData来存储延迟的CustomAction OfflineSxSInstall的属性。
  4. 最后,在SetupTypeDlg中,安装按钮会使用用户在BrowseDlg资源管理器中选择的路径触发延迟CustomAction OfflineSxSInstall
  5. 但是当我看到自定义安装时,OfflineSxSInstall输出的SXS_PATH的结果未被BrowseDlg更改。

    有什么问题?我将不胜感激任何帮助。

    main.wxs
    
    <?xml version="1.0" encoding="utf-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <Product Name="Hoge 1.12.0" Id="19DF906A-47EE-4B80-ABE8-D1D3F0D89136" UpgradeCode="9357FAA3-91F9-4976-882F-05F4098BBBE8" Language="1041" Codepage="932" Version="1.12.0" Manufacturer="Fuga">
            <Package Id="*" Keywords="Installer" Description="Hoge 1.12.0 Installer" Comments="Hoge is register trademark of Fuga company" Manufacturer="Fuga" InstallerVersion="100" Languages="1041" Compressed="yes" SummaryCodepage="932" />
            <Property Id="CMD">
              <DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
                <FileSearch Id="CmdExe" Name="cmd.exe"  />
              </DirectorySearch>
            </Property>
            <Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM 1" />
            <Property Id="DiskPrompt" Value="Fuga Hoge 1.12.0 Installer [1]" />
            <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
            <Property Id="SXS_PATH" Secure="yes" Value="SxSFolder" />
            <Property Id="SQLSERVER_INSTANCE_PATH" Secure="yes" Value="SQLServerFolder" />
    
            <Directory Id="TARGETDIR" Name="SourceDir">
                <Directory Id="ProgramFilesFolder" Name="PFiles">
                    <Directory Id="Hoge" Name="Hoge">
                        <Directory Id="INSTALLDIR" Name="Hoge 1.0">
                            <Component Id="CONFIGURE.BAT" DiskId="1" Guid="041ED78B-3D42-4EBD-8DAE-29D94DEFFC20">
                             <File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
                            </Component>
                        </Directory>
                    </Directory>
                </Directory>
                <Directory Id="ProgramMenuFolder" Name="Programs">
                </Directory>
                <Directory Id="SxSFolder" Name="SxS" />
                <Directory Id="SQLServerFolder" Name="SQLServer">
                </Directory>
                <Directory Id="DesktopFolder" Name="Desktop" />
            </Directory>
    
    
            <Feature Id="Complete" Title="Hoge 1.12.0" Description="Perfect Package" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
                <Feature Id="MainProgram" Title="Program" Description="Main Program。" Level="1">
                    <ComponentRef Id="CONFIGURE.BAT" />
                </Feature>
            </Feature>
            <UI Id="MyWixUI_Mondo">
                <UIRef Id="WixUI_Mondo" />
    
                <DialogRef Id="WindowsServerRolesAndFeaturesDlg" />
                <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="WindowsServerRolesAndFeaturesDlg" Order="2">
                 LicenseAccepted = "1"
                </Publish>
                <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">
                 LicenseAccepted = "1"
                </Publish>
                  <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">LicenseAccepted = "1"</Publish>
                  <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="SetTargetPath" Value="[SXS_PATH]" Order="2">1</Publish>
                  <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[SXS_PATH]" Order="1">1</Publish>
                  <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
            </UI>
            <UIRef Id="WixUI_ErrorProgressText" />
            <InstallExecuteSequence>
                <Custom Action="OfflineSxSInstall" After="InstallFiles">NOT Installed</Custom>
            </InstallExecuteSequence>  
        </Product>
    </Wix>
    
    
    WindowsServerRolesAndFeaturesDlg
    
    <?xml version="1.0" encoding="utf-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <Fragment>
            <CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="SXS_PATH=[SXS_PATH]" />
            <CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c &quot;&quot;[#file_configure.bat]&quot; &quot;[SXS_PATH]&quot;&quot;" />
    
            <Property Id="ONOFF_PROPERTY" Secure="yes" Value="0" />
    
            <UI>
                <Dialog Id="WindowsServerRolesAndFeaturesDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
                    <Control Id="RdxOnlineOffline" Type="RadioButtonGroup" X="40" Y="63" Width="300" Height="35" Property="ONOFF_PROPERTY" Text="Choose Install Method:">
                        <RadioButtonGroup Property="ONOFF_PROPERTY">
                            <RadioButton Value="0" X="0" Y="0" Width="300" Height="15" Text="Available Windows Update" />
                            <RadioButton Value="1" X="0" Y="20" Width="300" Height="15" Text="Offline Install" />
                        </RadioButtonGroup>
                    </Control>
                    <Control Id="SourcePath" Type="Text" X="45" Y="98" Width="200" Height="15" TabSkip="no" Text="Input SxS source path(&amp;U):" />
                    <Control Type="PathEdit" Id="TxtDir" X="45" Y="110" Width="220" Height="18" Property="SXS_PATH" Indirect="yes">
                        <Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
                        <Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
                    </Control>
                    <Control Id="ChangeFolder" Type="PushButton" X="265" Y="110" Width="56" Height="18" Text="Browse...">
                        <Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
                        <Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
                    </Control>
                    <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back(&amp;B)">
                        <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
                    </Control>
                    <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next(&amp;N)">
                        <Publish Event="DoAction" Value="SetCustomActionData">1</Publish>
                    </Control>
                    <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
                        <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
                    </Control>
                    <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
                    <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
                        <Text>Install Windows IIS role and .NET Framework Features</Text>
                    </Control>
                    <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
                    <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
                        <Text>{\WixUI_Font_Title}Add Windows IIS role and .NET Framework Features</Text>
                    </Control>
                    <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
                </Dialog>
            </UI>
        </Fragment>
    </Wix>
    

    configure.bat内容如下: 它将hoge.txt复制到hoge {%date%without slash} .txt并在其中写入%1参数。输出结果为“SxSFolder”

    setlocal
    echo on
    
    copy /Y C:\temp\hoge\hoge.txt C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt
    echo %1 > C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt 2>&1
    echo off
    endlocal
    exit /B 0
    

    P.S。 这是一个补充信息...我无法理解标签Directory Id =“SxSFolder”Name =“SxS”中定义的值“SxSFolder”的含义...(BrowseDlg PathEdit将其理解为“C:\” SxS \“作为初始值......)我想设置路径(可能包含在覆盖的SxSFolder.Name中......)到CustomActionData ....但是怎么做......?

    P.S 2。 我在阅读Reference directory install path in registry value using Wix之后更改了CustomActions以设置[“目录ID”] ....但仍然批量输出结果为“C:\ SxS \”....(未被BrowseDlg结果覆盖....)

        <CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="SxSFolder=[SxSFolder]" />
        <CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c &quot;&quot;[#file_configure.bat]&quot; &quot;[SxSFolder]&quot;&quot;" />
    

    P.S 3. msiexec / i {msi} / lv *(对不起日文字符......)告诉我有些事情覆盖了“SxSFolder”属性,但结果仍然没有被覆盖....

    200:アクション 10:39:37: BrowseDlg。Dialog created
    201:MSI (c) (B8:7C) [10:39:40:095]: PROPERTY CHANGE: Modifying SxSFolder property. Its current value is 'C:\SxS\'. Its new value: 'C:\'.
    202:MSI (c) (B8:7C) [10:39:43:411]: PROPERTY CHANGE: Modifying SxSFolder property. Its current value is 'C:\'. Its new value: 'C:\SxSDummy\'. (<--Overwritten Value)
    203:MSI (c) (B8:7C) [10:39:44:259]: Note: 1: 2727 2:  
    204:MSI (c) (B8:7C) [10:39:45:353]: Doing action: SetCustomActionData
    205:アクション 10:39:45: SetCustomActionData。
    206:アクション開始 10:39:45: SetCustomActionData。
    207:MSI (c) (B8:7C) [10:39:45:353]: PROPERTY CHANGE: Adding OfflineSxSInstall property. Its value is 'SxSFolder=C:\SxSDummy\'.
    208:アクション終了 10:39:45: SetCustomActionData。 戻り値 1。
    
    764:Property(C): OfflineSxSInstall = SxSFolder=C:\SxSDummy\
    
    769:Property(C): SxSFolder = C:\SxSDummy\
    

    I uploaded a full verbose log

1 个答案:

答案 0 :(得分:0)

这是自我回复。我从自定义操作中设置的属性ID中删除了所有underbars和所有小写字符。

以下是可以通过BrowserDlg覆盖该属性的wxs文件...

main.wxs

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Name="Hoge 1.12.0" Id="19DF906A-47EE-4B80-ABE8-D1D3F0D89136" UpgradeCode="9357FAA3-91F9-4976-882F-05F4098BBBE8" Language="1041" Codepage="932" Version="1.12.0" Manufacturer="Fuga">
        <Package Id="*" Keywords="Installer" Description="Hoge 1.12.0 Installer" Comments="Hoge is trademark of Fuga Inc." Manufacturer="Fuga" InstallerVersion="100" Languages="1041" Compressed="yes" SummaryCodepage="932" />
        <Property Id="CMD">
          <DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
            <FileSearch Id="CmdExe" Name="cmd.exe"  />
          </DirectorySearch>
        </Property>
        <Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM 1" />
        <Property Id="DiskPrompt" Value="Fuga Hoge 1.12.0 Installer [1]" />
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
        <Property Id="SXSPATH" Secure="yes" Value="SXSFOLDER" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder" Name="PFiles">
                <Directory Id="Hoge" Name="Hoge">
                    <Directory Id="INSTALLDIR" Name="Hoge 1.0">
                        <Component Id="CONFIGURE.BAT" DiskId="1" Guid="041ED78B-3D42-4EBD-8DAE-29D94DEFFC20">
                         <File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
                        </Component>
                    </Directory>
                </Directory>
            </Directory>
            <Directory Id="ProgramMenuFolder" Name="Programs">
            </Directory>
            <Directory Id="SXSFOLDER" />
            <Directory Id="DesktopFolder" Name="Desktop" />
        </Directory>


        <Feature Id="Complete" Title="Hoge 1.12.0" Description="Full Package" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
            <Feature Id="MainProgram" Title="Program" Description="Main Executable File" Level="1">
                <ComponentRef Id="CONFIGURE.BAT" />
            </Feature>
        </Feature>
        <UI Id="MyWixUI_Mondo">
            <UIRef Id="WixUI_Mondo" />

            <DialogRef Id="WindowsServerRolesAndFeaturesDlg" />
            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="WindowsServerRolesAndFeaturesDlg" Order="2">
             LicenseAccepted = "1"
            </Publish>
            <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">
             LicenseAccepted = "1"
            </Publish>
              <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">LicenseAccepted = "1"</Publish>
              <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="SetTargetPath" Value="[SXSPATH]" Order="2">1</Publish>
              <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[SXSPATH]" Order="1">1</Publish>
              <Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
        </UI>
        <UIRef Id="WixUI_ErrorProgressText" />
        <InstallExecuteSequence>
            <Custom Action="OfflineSxSInstall" After="InstallFiles">NOT Installed</Custom>
        </InstallExecuteSequence>  
    </Product>
</Wix>

WindowsServerRolesAndFeaturesDlg

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="[SXSFOLDER]" />
        <CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c &quot;&quot;[#file_configure.bat]&quot; &quot;[SXSFOLDER]&quot;&quot;" />

        <Property Id="ONOFF_PROPERTY" Secure="yes" Value="0" />

        <UI>
            <Dialog Id="WindowsServerRolesAndFeaturesDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
                <Control Id="RdxOnlineOffline" Type="RadioButtonGroup" X="40" Y="63" Width="300" Height="35" Property="ONOFF_PROPERTY" Text="Select Install Method:">
                    <RadioButtonGroup Property="ONOFF_PROPERTY">
                        <RadioButton Value="0" X="0" Y="0" Width="300" Height="15" Text="Available Windows Update" />
                        <RadioButton Value="1" X="0" Y="20" Width="300" Height="15" Text="Offline Install" />
                    </RadioButtonGroup>
                </Control>
                <Control Id="SourcePath" Type="Text" X="45" Y="98" Width="200" Height="15" TabSkip="no" Text="Input if offline and SxS source path available(&amp;U):" />
                <Control Type="PathEdit" Id="TxtDir" X="45" Y="110" Width="220" Height="18" Property="SXSPATH" Indirect="yes">
                    <Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
                    <Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
                </Control>
                <Control Id="ChangeFolder" Type="PushButton" X="265" Y="110" Width="56" Height="18" Text="Browse...">
                    <Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
                    <Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
                </Control>
                <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back(&amp;B)">
                    <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
                </Control>
                <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next(&amp;N)">
                    <Publish Event="DoAction" Value="SetCustomActionData">1</Publish>
                </Control>
                <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
                    <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
                </Control>
                <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
                <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
                    <Text>Install IIS role and .NET Framework features.</Text>
                </Control>
                <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
                <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
                    <Text>{\WixUI_Font_Title}Install IIS role and .NET Framework features</Text>
                </Control>
                <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
            </Dialog>
        </UI>
    </Fragment>
</Wix>