[wix-users] Custom Action to Create and Install a File?
Edwin Castro
egcastr at gmail.com
Sat Feb 22 00:50:08 PST 2020
SetProperty is a WiX specific thing. Think of it as syntax sugar. It
generates a custom action that sets a property. The default custom action
name is Set<PropertyName>. You can explicitly set the custom action name
with the Action attribute.
https://wixtoolset.org/documentation/manual/v3/xsd/wix/setproperty.html
Honestly, I thought I had initially made the mistake so I didn't want to
draw attention to it. ;-p
--
Edwin G. Castro
On Fri, Feb 21, 2020, 23:05 Russell Haley <russ.haley at gmail.com> wrote:
>
>
> On Thu, Feb 20, 2020 at 11:57 PM Edwin Castro <egcastr at gmail.com> wrote:
>
>> On Thu, Feb 20, 2020 at 10:17 PM Russell Haley <russ.haley at gmail.com>
>> wrote:
>>
>>> The Action executes, but I am not getting any values in the deferred
>>> CustomAction? This is confirmed in my log files:
>>> ...
>>> Action 21:47:33: Configure.LuaRocks.
>>> MSI (s) (A4:1C) [21:47:33:332]: Executing op:
>>> CustomActionSchedule(Action=Configure.LuaRocks,ActionType=1025,Source=BinaryData,Target=ConfigureLuaRocks,CustomActionData=LuaRocksConfigPath=;LuaRocksRootPath=;LuaRootPath=;ToolsPath=)
>>> MSI (s) (A4:A8) [21:47:33:335]: Invoking remote custom action. DLL:
>>> C:\WINDOWS\Installer\MSI2C78.tmp, Entrypoint: ConfigureLuaRocks
>>> MSI (s) (A4:6C) [21:47:33:335]: Generating random cookie.
>>> MSI (s) (A4:6C) [21:47:33:347]: Created Custom Action Server with PID
>>> 18240 (0x4740).
>>> MSI (s) (A4:8C) [21:47:33:380]: Running as a service.
>>> MSI (s) (A4:8C) [21:47:33:384]: Hello, I'm your 32bit Impersonated
>>> custom action server.
>>> SFXCA: Extracting custom action to temporary directory:
>>> C:\Users\russh\AppData\Local\Temp\MSI2C78.tmp-\
>>> SFXCA: Binding to CLR version v4.0.30319
>>> Calling custom action
>>> Winlua.Installer.CustomAction!Winlua.Installer.CustomAction.CustomActions.ConfigureLuaRocks
>>> ...
>>> (Full log here: https://pastebin.com/ycJfigrr - It takes a while to
>>> load!)
>>>
>>
>> Here is the relative order of when those properties got set
>>
>> MSI (s) (A4:1C) [21:47:25:910]: PROPERTY CHANGE: Adding
>> Configure.LuaRocks property. Its value is
>> 'LuaRocksConfigPath=;LuaRocksRootPath=;LuaRootPath=;ToolsPath='.
>> MSI (s) (A4:1C) [21:47:25:911]: PROPERTY CHANGE: Adding
>> LuaRocksConfigPath property. Its value is 'C:\Program Files
>> (x86)\WinLua\LuaRocks\\config-[LuaVersion2].lua'.
>> MSI (s) (A4:1C) [21:47:25:913]: PROPERTY CHANGE: Adding LuaRocksRootPath
>> property. Its value is 'C:\Program Files (x86)\WinLua\LuaRocks\'.
>> MSI (s) (A4:1C) [21:47:25:914]: PROPERTY CHANGE: Adding LuaRootPath
>> property. Its value is 'C:\Program Files (x86)\WinLua\Lua\'.
>> MSI (s) (A4:1C) [21:47:25:915]: PROPERTY CHANGE: Adding ToolsPath
>> property. Its value is 'C:\Program Files (x86)\WinLua\LLVM-MinGW\'.
>>
>> Notably, Configure.LuaRocks was set *before* the properties it depended
>> on. The Before attributes were set to Configure.LuaRocks which is the
>> deferred custom action. The custom action that sets the property is called
>> SetConfigure.LuaRocks.
>>
>> Also, LuaRocksConfigFileName must be set with SetProperty (not Property
>> like I did initially) and it must be set before LuaRocksConfigPath.
>>
>> Something like this
>>
>> <SetProperty Id="LuaRocksConfigFileName" Value="config-[LuaVersion2].lua"
>> Before="SetLuaRocksConfigPath" Sequence="execute" />
>>
>> <SetProperty Id="LuaRocksRootPath" Value="[LUAROCKS_INSTALLLOCATION]"
>> Before="SetLuaRocksConfigPath" Sequence="execute" />
>>
>> <SetProperty Id="LuaRocksConfigPath" Value="[LuaRocksRootPath]\[LuaRocksConfigFileName]"
>> Before="SetConfigure.LuaRocks" Sequence="execute" />
>>
>> <SetProperty Id="LuaRootPath" Value="[LUA_INSTALLLOCATION]"
>> Before="SetConfigure.LuaRocks" Sequence="execute" />
>>
>> <SetProperty Id="ToolsPath" Value="[LLVMMINGW_INSTALLLOCATION]"
>> Before="SetConfigure.LuaRocks" Sequence="execute" />
>>
>> <SetProperty Id="Configure.LuaRocks" Value="LuaRocksConfigPath=[
>> LuaRocksConfigPath];LuaRocksRootPath=[LuaRocksRootPath];LuaRootPath=
>> [LuaRootPath];ToolsPath=[ToolsPath]" Before="Configure.LuaRocks"
>> Sequence="execute" />
>>
>
> Oh, I'm sorry. I thought the Set... stuff was a typo! How am I completely
> not seeing that in the documentation? (I'll find it!)
> https://docs.microsoft.com/en-us/windows/win32/msi/custom-actions
>
> Ha ha. I've never had someone so politely tell me that I mangled their
> code. Thanks Edwin.
>
> To the Bat Cave!
> Russ
>
>>
>> --
>> Edwin G. Castro
>>
>>
More information about the wix-users
mailing list