Thanks Sohail. 

If anybody knows how to fix this, please tell me. Thanks in advance.

I don't know how to use batch file in customaction.

But I 
found 
http://blogs.technet.com/b/alexshev/archive/2008/02/21/from-msi-to-wix-part-5-custom-actions.aspx.
 Even Rob said it's not 
good(http://wix.sourceforge.net/manual-wix2/robmen_20040520.htm ), I just want 
to get something working today. We need to ship something tonight.

Anyway, I found type 22(vbscript) maybe the one we need. So I tried it. But it 
doesn't work for me. 

I mean, the vbscript itself works, here it is:
~~~~
Public Function Main()
Dim WshShell 
Set WshShell = WScript.CreateObject("WScript.Shell") 
  WshShell.CurrentDirectory = "C:\Program Files\Common Files\MyApp" 
  WshShell.Run "adxreg.exe /install=myapp.dll"
Set WshShell = Nothing
End Function


Main
~~~~


This works fine if I just run it. But if I include it in code it doesn't work:
<Component Id="Component_TFR" Guid="*">
                            <File Id='File_Fix' Name='fix.vbs' Source="fix.vbs" 
KeyPath="yes" Checksum="yes"/>
</Component> 

<CustomAction Id="DoDllRegistration"
FileKey="File_Tfr"
VBScriptCall="Main"
Execute="deferred"
Return="ignore"
HideTarget="no"
Impersonate="no" />

<InstallExecuteSequence>
<Custom Action="DoDllRegistration" Before="InstallFinalize" >Not 
Installed</Custom>
</InstallExecuteSequence>


Here is log:
Action 16:08:42: DoDllRegistration. 
MSI (s) (34:A8) [16:08:42:070]: Executing op: 
CustomActionSchedule(Action=DoDllRegistration,ActionType=3158,Source=C:\Program 
Files\MyApp\tfr.vbs,Target=Main,)
MSI (s) (34:CC) [16:08:42:070]: Generating random cookie.
MSI (s) (34:CC) [16:08:42:086]: Created Custom Action Server with PID 3296 
(0xCE0).
MSI (s) (34:54) [16:08:42:148]: Running as a service.
MSI (s) (34:94) [16:08:42:148]: Hello, I'm your 32bit Elevated custom action 
server.
MSI (s) (34:30) [16:08:42:148]: Entering MsiProvideComponentFromDescriptor. 
Descriptor: ,igp...@+@w'iRd7tcotMainApp>M5KDYSUnf(HA*L[xeX)y, PathBuf: BEF348, 
pcchPathBuf: BEF344, pcchArgsOffset: BEF29C
MSI (s) (34:30) [16:08:42:148]: MsiProvideComponentFromDescriptor called for 
component {997FA962-E067-11D1-9396-00A0C90F27F9}: returning harcoded 
oleaut32.dll value
MSI (s) (34:30) [16:08:42:148]: MsiProvideComponentFromDescriptor is returning: 
0
MSI (s) (34:30) [16:08:42:164]: Note: 1: 1720 2: DoDllRegistration 3: 
-2146827864 4: Microsoft VBScript runtime error 5: Object required: 'WScript' 
6: 
3 7: 2 

Info 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 DoDllRegistration script error 
-2146827864, Microsoft VBScript runtime error: Object required: 'WScript' Line 
3, Column 2, 

MSI (s) (34:A8) [16:08:42:164]: Executing op: 
End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=63735264)
MSI (s) (34:A8) [16:08:42:179]: User policy value 'DisableRollback' is 0
MSI (s) (34:A8) [16:08:42:179]: Machine policy value 'DisableRollback' is 0
Action 16:08:42: RollbackCleanup. Removing backup files


Why it's okay if I run it manually but not work in Wix? For the 'WScript' 
error, 
MS has examples: http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx 






________________________________
From: Sohail Somani <soh...@taggedtype.net>
To: wix-users@lists.sourceforge.net
Sent: Fri, September 10, 2010 4:00:36 PM
Subject: Re: [WiX-users] How to change to a directory and run customaction 
inside that directory?

On 10-09-10 4:31 PM, little.forest wrote:
> We have to change directory to "C:\Program Files\Common Files\MyApp\" first 
and
> then run "adxreg.exe /install=myapp.dll". How to do it in Wix?
>

You can do it in a batch file and pass it [INSTALLDIR] in the ExeCommand 
(iirc). So something like:

<CustomAction ... ExeCommand="[INSTALLDIR]\batchfile.bat" ...>

The batch file can use %~dp0 to change to the installdirectory first.

-- 
Sohail Somani
--
iBlog : http://uint32t.blogspot.com
iTweet: http://twitter.com/somanisoftware
iCode : http://bitbucket.org/cheez



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to