2
votes

Wix toolset 3.10

Finally I managed to make a simple mock window for installer...But I have failed to overwrite the default value SxSFolder of the property SXS_PATH...

My conception in the install sequence:

  1. After a LicenseAgreementDlg, a customized dialog named WindowsServerRolesAndFeaturesDlg spawns.
  2. In the WindowsServerRolesAndFeaturesDlg, user can browse BrowseDlg to input the explorer path to a path edit TxtDir (id est property SXS_PATH overwritten)
  3. Pushing next button in the customized window, a CustomAction SetCustomActionData to store the property for the deferred CustomAction OfflineSxSInstall.
  4. Finally, in the SetupTypeDlg, install button fires the deferred CustomAction OfflineSxSInstall with the path which user choosing in the BrowseDlg explorer.

But when I saw the custom install, OfflineSxSInstall output the result of SXS_PATH not changed by the BrowseDlg.

What is wrong? I would appreciate any help.

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 content is below: It copies the hoge.txt to a hoge{%date% without slash}.txt and writes %1 parameter inside. Output result is "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. This is a supplementary information...I failed to understand the meaning of the value "SxSFolder" which is defined in the tag Directory Id="SxSFolder" Name="SxS"...(BrowseDlg PathEdit understands it as "C:\SxS\" as initial value...) I want to set the path (probably contained in the overwritten SxSFolder.Name...) to CustomActionData.... But how to do...?

P.S 2. I changed CustomActions to set ["directory id"] after reading Reference directory install path in registry value using Wix.... but still batch output result is "C:\SxS\"....(Not Overwritten by BrowseDlg result....)

    <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* (Sorry for Japanese Characters....) told me something overwritten the "SxSFolder" property, but result is still not overwritten....

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
I posted a same question in Wix mailing list...illuminate33
I uploaded a verbose log file and embedded the hyperlink.illuminate33
I changed the syntax to Value="[SxSFolder]", but the result is same(not overwritten of the batch output.) May I show you Verbose log again?illuminate33
May I ask you, what is 'meta' value?illuminate33
I want to move this discussion to chat, but my popularity in stackoverflow is not enough...illuminate33

1 Answers

0
votes

This is self reply. I removed all underbars and all lowercase characters from property id which set in the custom action.

Below is the wxs files which can overwrite the property by the BrowserDlg...

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>