[wix-users] CustomAction does not seem to be called from the msi
Hoover, Jacob
Jacob.Hoover at greenheck.com
Thu Feb 9 08:17:10 PST 2017
Be aware, a user can install without the UI sequence running. Your CA should be scheduled to run in both, and you should determine why it wasn't working inside the InstallExecute sequence.
-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Urban Olars
Sent: Thursday, February 09, 2017 5:53 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] CustomAction does not seem to be called from the msi
I finally found the problem. The <Custom Action="IronCADRootDirectory"
Before="AppSearch" /> has to be inside an InstallUISequence> tag, not inside the <InstallExecuteSequence> tag like I had done. The result from my incorrect way of doing it was that the custom action got executed way too late.
Thank you all for the help.
2017-02-07 9:13 GMT+01:00 Urban Olars <urban.olars at gmail.com>:
> Hi,
>
> I am trying to learn how to write custom actions in C++ and how to use
> them in my msi installation project. Unfortunately with no luck so
> far. I have looked at numerous examples I have found on internet but
> still have not found out what I am doing wrong. I kindly ask for input
> from someone on this mailing list. Thank you in advance.
>
>
> This is part of the code in my *.wxs file:
> <Binary Id="CAICRoot" SourceFile="..\CustomActions\
> CustomActions\bin\Release\CustomActions.dll" /> <CustomAction
> Id="IronCADRootDirectory" BinaryKey="CAICRoot"
> DllEntry="GetICRootDir" Execute="firstSequence" HideTarget="no" />
>
> <InstallExecuteSequence>
> <Custom Action='IronCADRootDirectory' Before='InstallInitialize'/>
> <RemoveExistingProducts Before="InstallInitialize"></
> RemoveExistingProducts>
> </InstallExecuteSequence>
>
> <Condition Message="IronCAD root directory not found. Installation
> aborting"> <![CDATA[ICROOTDIR]]> </Condition> ...
> ...
>
>
> This is part of the code in my custom action dll:
> UINT __stdcall GetICRootDir(MSIHANDLE hInstall) { MessageBox(NULL ,
> _T("It got called!") , _T("Title") , MB_OK); HRESULT hr = S_OK; UINT
> er = ERROR_SUCCESS; // Initialize WiX Custom Action hr =
> WcaInitialize(hInstall, "GetICRootDir"); ExitOnFailure(hr, "Failed to
> initialize"); WcaLog(LOGMSG_STANDARD, "Initialized.");
>
> if (hr == ERROR_SUCCESS)
> {
> LPWSTR lpwString = L"C:\\Program Files\\IronCAD"; // This is
> just for testing. In reality I will look it up in the registry and cut
> away part of the string hr = ::WcaSetProperty(TEXT("ICROOTDIR"),
> lpwString); ExitOnFailure(hr, "Failed to set property"); } ...
> ...
>
>
> My msi project builds without errors but when I run the msi file, it
> always stops at the condition message. Obviously, no property called
> ICROOTDIR has been set. I added code for a message box in the custom
> dll so I should know that the function at least gets called but this
> message box has never showed up so far. My assumption is therefore
> that I have missed something fundamental so the custom dll never even gets called.
>
> I have added the entrypoint in the *.def file of my custom dll project:
> LIBRARY "CustomActions"
>
> EXPORTS
>
> GetICRootDir
>
>
> I haven't learnt yet how to log what is happening but I guess I will
> have to unless someone of you can see right away what the problem is.
>
>
>
> Regards
> Urban Olars
>
--
/Urban Olars
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users
mailing list