[wix-users] System Error in Custom Action when generating a binary file. The system cannot find the path specified

Anna Flyam | Landtech anna at landtechdataservices.com
Mon Jan 2 06:53:48 PST 2017


Thank you, Christopher so very much! Your posts are very useful.
Before I will start making changes, can you please take a look at my latest
result? Thank you in advance.
After sending my question on Friday, I made some changes and not getting
any errors in CA and getting the Property value, but my custom action is
not creating the file using that Property.
My task is very simple :
Create 2 Properties-USERNAME and LICDIR(which is the INSTALLDIR), set them,
pass and read them in the CA using session.CustomActionData["USERNAME"] and
session.CustomActionData["LICDIR"]
Result: create a file using LICDIR property and write USERNAME property to
that file.
The log file shows that I am getting both Properties correctly:
SFXCA: Extracting custom action to temporary directory:
C:\Windows\Installer\MSIEC35.tmp-\
Calling custom action
ReadPropertyCustomAction!ReadPropertyCustomAction.CustomActions.ReadProperty
Username is: joe
Full Path is = C:\Test\PassingPropertyInstaller\mytest.txt
But the CA/File.Open* is trying to  create the file under*
C:\Windows\Installer\MSIEC35.tmp-/ + [Passed LICDIR Property] which is
wrong path.

FS name=C:\Windows\Installer\MSIEC35.tmp-
\C:\Test\PassingPropertyInstaller\mytest.txt

Is this DTF feature or my mistake?

Thank you,
anna


The reason: the
C:\Windows\Installer\MSIEC35.tmp-\C:\Test\PassingPropertyInstaller\mytest.txt


FS
name=C:\Windows\Installer\MSIEC35.tmp-\C:\Test\PassingPropertyInstaller\mytest.txt




*Anna Flyam*
*Software Engineer*
*Landtech Data Services*

[image: Landtech] <http://www.landtechdata.com/index.php>
Main O: (800)-835-1523 <%28800%294835-1523> | F: (561)-798-818
<%28561%294798-0818> |  E: Anna at Landtechdataservices.com
<Anna at landtechdataservices.com>
1460 Royal Palm Beach Blvd,
Royal Palm Beach, Florida 33411
www.landtechdata.com

On Sun, Jan 1, 2017 at 9:39 PM, Christopher Painter <chrpai at iswix.com>
wrote:

> CustomActionData has to be a property with a name that matches the name of
> the deferred custom action.
>
>
> Custom Action set Property  name Foo   value  Bar.
>
> Custom Action  Foo  binary some.dll  target Foo
>
>
> [CustomAction]
>
> public static ActionResult Foo( Session session )
>
> {
>
>    var customActionData = session[CustomActionData];
>
>  //  customActionData now equals Foo
>
> }
>
> DTF has a class called that assists in serializing and deserializing
> multiple key value pairs into this single property.
>
> Here's a blog article I wrote about this topic in the past.
>
> http://blog.iswix.com/2011/10/beam-me-up-using-json-to-serialize.html
>
>
> ________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of
> Anna Flyam | Landtech <anna at landtechdataservices.com>
> Sent: Friday, December 30, 2016 10:57 AM
> To: WiX Toolset Users Mailing List
> Subject: [wix-users] System Error in Custom Action when generating a
> binary file. The system cannot find the path specified
>
> My deferred Custom Action is responsible for creating and writing to a
> binary file Before InstallFinalize.
> When testing using hardcoded file name/path, it works, but I need to use
> [file path] from the Property that I am passing to this CA.
> I use session.Log to print the value of that property and it looks good,
> but the file is not getting generated.
> It must be something simple that I am missing. Sequence? Hope you can help.
>
> 1. Directory ID is "BIN"
> Directories.wxs
> <Directory Id="TARGETDIR" Name="SourceDir">
>           <Directory Id="INSTALLFOLDER" Name="Apps" >
>             <Directory Id ="BIN" Name="BIN" />
> ...
> <!-- 2. Create Empty Folder. This folder will be used in my CA to create a
> file-->
> AppsComponents.wxs
> <DirectoryRef Id="BIN" >
>       <Component Id="CMP_Bin" Guid="{E005D3D9-3624-42BE-
> 8BCB-16988453B661}"
> KeyPath="yes">
>         <CreateFolder />
>       </Component>
>    </DirectoryRef>
>
> Product.wxs
>  <!-- 3. Create Property for deferred CA-->
>  <Property Id="MYFILEFULLPATHPROPERTY" Value="[BIN]MYFILE.DAT" />
>   <!-- 4. CA and set property-->
>  <CustomAction Id="CA_WriteBinaryFile"
>                   BinaryKey="LtxCustomActionsDLL"
>                   DllEntry="WriteBinaryFile"
>                   Execute="deferred"
>                   Impersonate="no"
>                   Return="check" />
>
>  <SetProperty Id="CA_WriteBinaryFile"
>
>  Value="SERIALNUMBER=[SERIALNUMBER];MYFILEFULLPATHPROPERTY=[
> MYFILEFULLPATHPROPERTY]"
>                      Sequence="execute"
>                      Before="CA_WriteBinaryFile" />
>
> <!-- 5. Schedule deferred CA-->
> <InstallExecuteSequence>
>       <Custom Action="CA_WriteBinaryFile" Before="InstallFinalize">NOT
> Installed AND NOT REMOVE</Custom>
> </InstallExecuteSequence>
>
>
> [CustomAction]
> public static ActionResult WriteBinaryFile(Session session)
> {
> ...
> //"C:\\APPS\\BIN\\MYFILE.DAT"
>
>  myBinFile = session.CustomActionData["MYFILEFULLPATHPROPERTY"];
>
>
>  using (BinaryWriter writer = new BinaryWriter(File.Open( myBinFile,
> FileMode.Create)))
>                 { ...}
>
> Error from the install log:
> Action 10:25:47: CA_WriteBinaryFile.
> MSI (s) (40:08) [10:25:47:498]: Executing op:
> CustomActionSchedule(Action=CA_WriteBinaryFile,ActionType=
> 3073,Source=BinaryData,Target=WriteBinaryFile,
> CustomActionData=SERIALNUMBER=ABC-DC;MYFILEFULLPATHPROPERTY=
> [BIN]MYFILE.DAT)
> MSI (s) (40:64) [10:25:47:701]: Invoking remote custom action. DLL:
> C:\WINDOWS\Installer\MSI7AAF.tmp, Entrypoint: WriteBinaryFile
> MSI (s) (40:B8) [10:25:47:701]: Generating random cookie.
> MSI (s) (40:B8) [10:25:47:701]: Created Custom Action Server with PID 3508
> (0xDB4).
> MSI (s) (40:EC) [10:25:49:186]: Running as a service.
> MSI (s) (40:EC) [10:25:49:201]: Hello, I'm your 32bit Elevated Non-remapped
> custom action server.
> SFXCA: Extracting custom action to temporary directory:
> C:\WINDOWS\Installer\MSI7AAF.tmp-\
> SFXCA: Binding to CLR version v4.0.30319
> Calling custom action
> LtxCustomActions!LtxCustomActions.CustomActions.WriteBinaryFile
> Started CA WriteBinaryFile
> Serial Number:ABC-DC
> Number of Users = 5
> Our Binary file  = C:\Apps\BIN\MYFILE.DAT <<< session.Log
>
> MSI (s) (40:08) [10:25:55:717]: Executing op:
> End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=1471642952)
>
> *MSI (s) (40:08) [10:25:55:826]: Note: 1: 2265 2:  3: -2147287035  <<<<<
> Error: Cannot find the path specified*
>
> MSI (s) (40:08) [10:25:55:826]: User policy value 'DisableRollback' is 0
> MSI (s) (40:08) [10:25:55:826]: Machine policy value 'DisableRollback' is 0
> MSI (s) (40:08) [10:25:55:826]: Note: 1: 2265 2:  3: -2147287035
> Action 10:25:55: RollbackCleanup. Removing backup files
> RollbackCleanup: File: C:\Config.Msi\279d6517.rbf
> RollbackCleanup: File: C:\Config.Msi\279d6518.rbf
> MSI (s) (40:08) [10:25:55:873]: Note: 1: 2318 2:
> MSI (s) (40:08) [10:25:55:873]: Note: 1: 2318 2:
> MSI (s) (40:08) [10:25:55:967]: Calling SRSetRestorePoint API.
> dwRestorePtType: 0, dwEventType: 103, llSequenceNumber: 28, szDescription:
> "".
> MSI (s) (40:08) [10:25:55:967]: The call to SRSetRestorePoint API
> succeeded. Returned status: 0.
> MSI (s) (40:08) [10:25:55:967]: Unlocking Server
> MSI (s) (40:08) [10:25:56:077]: PROPERTY CHANGE: Deleting UpdateStarted
> property. Its current value is '1'.
> Action ended 10:25:56: InstallFinalize. Return value 1.
>
>
>
> *Anna Flyam*
> *Software Engineer*
> *Landtech Data Services*
>
> [image: Landtech] <http://www.landtechdata.com/index.php>
> Welcome to Landtech | Customized Title Settlement Software<http://www.
> landtechdata.com/index.php>
> www.landtechdata.com
> Founded in September 1981, Landtech Data Services is the first Real Estate
> Settlement Software built for PC. Seamlessly integrated with dozens of
> Industry Standard ...
>
>
>
> Main O: (800)-835-1523 <%28800%294835-1523> | F: (561)-798-818
> <%28561%294798-0818> |  E: Anna at Landtechdataservices.com
> <Anna at landtechdataservices.com>
> 1460 Royal Palm Beach Blvd,
> Royal Palm Beach, Florida 33411
> www.landtechdata.com<http://www.landtechdata.com>
> Welcome to Landtech | Customized Title Settlement Software<http://www.
> landtechdata.com/>
> www.landtechdata.com
> Founded in September 1981, Landtech Data Services is the first Real Estate
> Settlement Software built for PC. Seamlessly integrated with dozens of
> Industry Standard ...
>
>
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
> WiX Support | WiX Experts and Resources from FireGiant<http://www.
> firegiant.com/>
> www.firegiant.com
> WiX Support | Installation, Development, Deployment | WiX Experts and
> Resources from FireGiant
>
>
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>



More information about the wix-users mailing list