I am currently working on a CustomAction library for reading and writing INI (outside C:\Windows) and XML files. I already looked at this SO question but the suggested answers did not help with my issue. The CustomAction (for reading a value from an INI file) I am trying to execute is defined as
<CustomAction Id="MyCustomAction"
Execute="deferred"
Impersonate="no"
Return="ignore"
BinaryKey="MyCALibrary.CA.dll"
DllEntry="MyCustomActionEntry" />
and scheduled as
<InstallExecuteSequence>
<Custom Action="MyCustomAction" After="InstallFiles">
<![CDATA[NOT Installed AND NOT PATCH]]>
</Custom>
</InstallExecuteSequence>
As it is a deferred action, it receives data through a property:
<Property Id="MyCustomAction"
Value="File=[INSTALLDIR]cfg\MyConfig.ini;Section=MyConfig;Key=MyKey"/>
The (C#) implementation of my CustomAction looks like this:
[CustomAction]
public static ActionResult MyCustomActionEntry(Session session)
{
try
{
session.Log("Begin MyCustomActionEntry");
CustomActionData data = session.CustomActionData;
session.Log($"Data: '{data}'.");
string fileName = data["File"];
string sectionName = data["Section"];
string keyName = data["Key"];
// ... check if all properties are set
// ... removed for brevity
session.Log($"- Parametrization: (File={fileName}; Section={sectionName}; Key={keyName}.");
if(File.Exists(fileName))
{
session.Log("File found on disk.");
}
else
{
session.Log("File NOT found on disk.");
}
// ... actual INI Access - F A I L S
}
catch(Exception ex)
{
//... handle any errors
}
}
Using Orca, I see that the CustomAction is most likely scheduled correctly - the table InstallExecuteSequence
shows:
...
InstallFiles 4000
...
MyCustomAction 4001
...
Of course, I now looked at the install log for hints. The log shows: (In what I guess is the immediate phase):
Action ended <time>: InstallFiles. Return value 1.
MSI (s) (F8:98) <time>: Doing action: MyCustomAction
Action start <time>: MyCustomAction.
Action ended <time>: MyCustomAction. Return value 1.
For what I think would be the deferred phase (further down in the log):
MSI (s) (F8:98) <time>: Executing op: FileCopy(SourceName=qjlzmwkb.ini|MyConfig.ini,SourceCabKey=<key>,DestName=MyConfig.ini,...,InstallMode=58982400,...)
MSI (s) (F8:98) <time>: File: C:\tmp\MyApp\cfg\MyConfig.ini; To be installed; Won't patch; No existing file
MSI (s) (F8:98) <time>: Source for file '<key>' is compressed
...
Begin MyCustomActionEntry
...
Data: 'File=C:\tmp\MyApp\cfg\MyConfig.ini;Section=MyConfig;Key=MyKey'.
...
- Parametrization: (File=C:\tmp\MyApp\cfg\MyConfig.ini; Section=MyConfig; Key=MyKey).
...
File NOT found on disk.
After the installer finishes, the file is at exactly where I expepct it - the location referenced in the custom action.
I assume that the installed files should be available on disk after InstallFiles
in the deferred stage of the execute phase for any CustomActions to access.
Has anyone else observed similar behavior and can give me hints on what else to do?
HeatDirectory
element. Using Orca, I do not even see an IniFile table. – vonludi