I'm having trouble getting a VBScript custom action to work.  It's
purpose it so backup some files that the major upgrade may otherwise
delete.


My WiX source looks like this:

    <Binary Id='project_backup.vbs' SourceFile='project_backup.vbs'/>
    <CustomAction Id='setProjectFolder' Property='USERPROJECTFOLDER'
Value='[MyProduct_Projects]'/>
    <CustomAction Id='makeProjBackups' BinaryKey='project_backup.vbs'
VBScriptCall='backupProjects' Execute='immediate' Return='check'/>
    <InstallExecuteSequence>
      <Custom Action='setProjectFolder' Before='makeProjBackups'/>
      <Custom Action='makeProjBackups'
Before='InstallFinalize'><![CDATA[NOT Installed]]></Custom>
    </InstallExecuteSequence>


My script (project_backup.vbs) looks like:

' VBScript source code
Function backupProjects
Dim proj_folder, backup_proj_folder
Set proj_folder = Session.Property("USERPROJECTFOLDER")
MsgBox "The project folder is "+proj_folder
Set backup_proj_folder = proj_folder+"backup"
MsgBox "The project backup folder is "+backup_proj_folder
Dim objFSO, objFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
if not objFSO.FolderExists(backup_proj_folder) then
    Set objFolder = objFSO.CreateFolder(backup_proj_folder)
end if
Dim objShell
Set objShell = CreateObject("WScript.Shell")
cmdLine = "cmd.exe /C move /Y """ + proj_folder + "*.prj"" """ +
backup_proj_folder + """"
WScript.echo(cmdLine)
objShell.Run(cmdLine)
End Function


The message boxes are in there strictly for debugging/testing at this point.

The install fails with an error when it tries to run my
makeProjBackups action:  Here is the relevant section of the log:

Action start 9:35:17: PublishProduct.
PublishProduct:
Action ended 9:35:17: PublishProduct. Return value 1.
MSI (s) (6C:3C) [09:35:17:726]: Doing action: setProjectFolder
MSI (s) (6C:3C) [09:35:17:726]: Note: 1: 2205 2:  3: ActionText
Action 9:35:17: setProjectFolder.
Action start 9:35:17: setProjectFolder.
MSI (s) (6C:3C) [09:35:17:726]: PROPERTY CHANGE: Adding
USERPROJECTFOLDER property. Its value is 'C:\Documents and
Settings\All Users\Documents\MyCompany\MyProduct\Projects\'.
Action ended 9:35:17: setProjectFolder. Return value 1.
MSI (s) (6C:3C) [09:35:17:726]: Doing action: makeProjBackups
MSI (s) (6C:3C) [09:35:17:726]: Note: 1: 2205 2:  3: ActionText
Action 9:35:17: makeProjBackups.
Action start 9:35:17: makeProjBackups.
MSI (s) (6C:4C) [09:35:17:726]: Generating random cookie.
MSI (s) (6C:4C) [09:35:17:726]: Created Custom Action Server with PID
3968 (0xF80).
MSI (s) (6C:40) [09:35:17:741]: Running as a service.
MSI (s) (6C:40) [09:35:17:741]: Hello, I'm your 32bit Impersonated
custom action server.
MSI (s) (6C:E0) [09:35:17:741]: Entering
MsiProvideComponentFromDescriptor. Descriptor:
AYR&1QHTd?I,.Gi%~HE%MobilinkLite_Files>M5KDYSUnf(HA*L[xeX)y, PathBuf:
C3F348, pcchPathBuf: C3F344, pcchArgsOffset: C3F2A4
MSI (s) (6C:E0) [09:35:17:741]: MsiProvideComponentFromDescriptor
called for component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning
harcoded oleaut32.dll value
MSI (s) (6C:E0) [09:35:17:741]: MsiProvideComponentFromDescriptor is
returning: 0
MSI (s) (6C:E0) [09:35:17:741]: Note: 1: 2205 2:  3: Error
MSI (s) (6C:E0) [09:35:17:741]: Note: 1: 2228 2:  3: Error 4: SELECT
`Message` FROM `Error` WHERE `Error` = 1720
Error 1720. There is a problem with this Windows Installer package. A
script required for this install to complete could not be run. Contact
your support personnel or package vendor.  Custom action
makeProjBackups script error -2146827864, Microsoft VBScript runtime
error: Object required: '[string: "C:\Documents and Set"]' Line 4,
Column 1,
MSI (s) (6C:E0) [09:35:32:101]: Note: 1: 2205 2:  3: Error
MSI (s) (6C:E0) [09:35:32:101]: Note: 1: 2228 2:  3: Error 4: SELECT
`Message` FROM `Error` WHERE `Error` = 1709
MSI (s) (6C:E0) [09:35:32:101]: Product: MyCompany MyProduct -- Error
1720. There is a problem with this Windows Installer package. A script
required for this install to complete could not be run. Contact your
support personnel or package vendor.  Custom action makeProjBackups
script error -2146827864, Microsoft VBScript runtime error: Object
required: '[string: "C:\Documents and Set"]' Line 4, Column 1,

Action ended 9:35:32: makeProjBackups. Return value 3.
MSI (s) (6C:3C) [09:35:32:101]: Machine policy value 'DisableRollback' is 0


Any assistance it figuring out what exactly is going wrong is
appreciated.  Specifically I don't have a clue what all that
"MsiProvideComponentFromDescriptor" stuff is all about.

Thanks,

Scott

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to