我有一个wix自定义动作
<CustomAction Id="BaselineSync_Cmd" Property="BaselineSync" Execute="immediate"
Value=""robocopy" "[SI_BUP]" "[SI_PROD]" /PURGE" />
<CustomAction Id="BaselineSync" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="RoboCopy_Cmd" Property="RoboCopy" Execute="immediate"
Value=""robocopy" "[INSDIR]" [SI_PROD]" />
<CustomAction Id="RoboCopy" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
早期的robocopy命令对我有用,但不适用于第二种。 安装时,我通过命令行传递SI_BUP,INSDIR和SI_PROD的值。像这样:INSDIR = C:\ testing \ CONTENT SI_BUP = C:\ testing \ BACKUP SI_PROD = C:\ testing \ PROD / qn / l * v install.log
从第一个自定义操作中记录:
MSI (s) (74:88) [15:00:52:118]: Executing op: CustomActionSchedule(Action=BaselineSync,ActionType=3137,Source=BinaryData,Target=CAQuietExec,CustomActionData="robocopy" "C:\testing\BACKUP" "C:\testing\PROD" /PURGE /e)
CAQuietExec: -------------------------------------------------------------------------------
CAQuietExec: ROBOCOPY :: Robust File Copy for Windows
CAQuietExec: -------------------------------------------------------------------------------
CAQuietExec:
CAQuietExec: Started : Thu Jun 19 15:00:52 2014
CAQuietExec:
CAQuietExec: Source : C:\testing\BACKUP\
CAQuietExec: Dest : C:\testing\PROD\
从第二个自定义操作中记录:
MSI (s) (74:88) [15:00:52:190]: Executing op: CustomActionSchedule(Action=RoboCopy,ActionType=3137,Source=BinaryData,Target=CAQuietExec,CustomActionData="robocopy" "C:\testing\CONTENT\" "C:\testing\PROD" /e)
CAQuietExec:
CAQuietExec: -------------------------------------------------------------------------------
CAQuietExec: ROBOCOPY :: Robust File Copy for Windows
CAQuietExec: -------------------------------------------------------------------------------
CAQuietExec:
CAQuietExec: Started : Thu Jun 19 15:00:52 2014
CAQuietExec:
CAQuietExec: Source : C:\testing\CONTENT" C:\testing\PROD \e\
CAQuietExec: Dest -
我无法弄清楚我应该做什么,以便robocopy工作正常。我不是在寻找一种批量方法来实现这一目标......只是习惯性的。请帮忙。
答案 0 :(得分:0)
[INSDIR]
变量中有一个尾部反斜杠,第二个CA上的这部分日志证明了这一点:
"robocopy" "C:\testing\CONTENT\" "C:\testing\PROD"
而不是C:\testing\CONTENT\
,您需要C:\Testing\CONTENT
。这本质上是一个Robocopy语法错误。
答案 1 :(得分:0)
<CustomAction Id="BaselineSync_Cmd" Property="BaselineSync" Execute="immediate"
Value=""robocopy" "[SI_BUP]" "[SI_PROD]" /PURGE /e" />
<CustomAction Id="BaselineSync" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="RoboCopy_Cmd" Property="RoboCopy" Execute="immediate"
Value=""robocopy" "[INSDIR]$(var.AppName)" "[SI_PROD]" /e" />
<CustomAction Id="RoboCopy" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
上面显示的第二个习惯上的一点变化-RoboCopy_Cmd我添加了$(var.AppName),它在msbuild文件中设置,从这里调用这个习惯,并且命令行参数的微小变化达到了预期的结果
命令行现在看起来像:
INSDIR=C:\testing\CONTENT SI_BUP=C:\testing\MyProd SI_PROD=C:\testing\PROD\MyProd
在msbuild文件中,AppName设置为:
<AppName>MyProd</AppName>
和INSDIR是产品安装的位置。所以内容安装到C:\testing\CONTENT\MyProd