installshieldinstallshield-2011

How do you access variables stored in a Direct Editor table from an Installshield vbscript or javascript custom action?


I need to read or change the value of "Enable32bitAppOnWin64" in the IsIISProperty table from within a custom action. Now while I can access properties from the Property Manager by Session.Properties("PropertyName")

I can't see how to do the same for the property tables. I have tried {ISIISProperty1}, [ISIISProperty1] and Session.Properties("ISIISProperty1") all with no success.

How do I achieve this?

Any help will be appreciated.

Thanks


Solution

  • I haven't been able to find any information on accessing properties from installer tables in a custom action. What I did find out was that you can write some installer SQL syntax to update the tables from custom actions, but this was overkill and I couldn't get it to work.

    What I have been able to do is use property substitutions with the ISIISProperty table.

    1. I created two new properties in the Property table called ASPBITNESS and ALLOWTHIRTYTWOBIT which are set to x86 and true respectively by default.
    2. Then I edited the ISIISProperty table in the direct editor and replaced the values for Enable32bitAppOnWin64 and AspNetVerBitness with [ALLOWTHIRTYTWOBIT] and [ASPBITNESS] respectively. Interestingly, the Enable 32-Bit Applications setting shows "No" in the InstallShield designer, even though the [ALLOWTHIRTYTWOBIT] property is set to true by default.
    3. Finally, I have a custom action that conditionally (NOT REMOVE and VersionNT64 and IIS_VERSION > "#6") fires at the very start of the install to change those values accordingly.

    The custom action code code is:

    On Error Resume Next
    
    ' change the properties for x64 systems
    if SYSINFO.bIsWow64 <> 0 then
        Session.Property("ASPBITNESS") = "x64"  
        Session.Property("ALLOWTHIRTYTWOBIT") = "false"
    end if
    

    Before the MSI logs showed:

    InstallShield 12:09:19: SetVRootProperties for virtual directory
    'MyWebApp', app ''
    InstallShield 12:09:19: IIS7 check for ASP.NET version bitness on application pool
    'MyAPPPool', install is requesting 'x86'
    ...
    InstallShield 12:09:19: SetAspversion: machine is 64-bit and
    IIS running in a bit mode other than the currently selected mode
    ...
    InstallShield 12:09:19: Error with IISRT: -2172
    ...
    CustomAction ISIISInstall returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

    After these changes the applications install and the logs now show:

    MSI (s) (D4:1C) [10:53:18:662]: Doing action: Set64Bit
    Action 10:53:18: Set64Bit.
    Action start 10:53:18: Set64Bit.
    MSI (s) (D4:0C) [10:53:18:678]: Created Custom Action Server with PID 912 (0x390).
    MSI (s) (D4:D0) [10:53:18:709]: Running as a service.
    MSI (s) (D4:D0) [10:53:18:709]: Hello, I'm your 32bit Impersonated custom action server.
    MSI (s) (D4!1C) [10:53:18:725]: PROPERTY CHANGE: Modifying ASPBITNESS property.
    Its current value is 'x86'. Its new value: 'x64'.
    MSI (s) (D4!1C) [10:53:18:725]: PROPERTY CHANGE: Modifying ALLOWTHIRTYTWOBIT
    property. Its current value is 'true'. Its new value: 'false'.

    And then:

    InstallShield 10:53:20: SetVRootProperties for virtual directory
    'MyWebApp', app ''
    InstallShield 10:53:20: IIS7 check for ASP.NET version bitness on application pool
    'MyAppPool', install is requesting 'x64'
    InstallShield 10:53:20: Application pool Enable32bitAppOnWin64 value is 'false'
    InstallShield 10:53:20: ASP.NET version can be set for 64-bit.
    InstallShield 10:53:20: Configuring ASP .NET version:
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir