.NET vs installer安装项目失败汇总

1. 提交阶段,使用vbs调用mysql-connector-net-6.6.5.msi报错

vbs 脚本如下:

Dim ret
Set WshShell = WScript.CreateObject("WScript.Shell") 
ret = WshShell.Run("msiexec /i mysql-connector-net-6.6.5.msi") 

解决方案:

打开 %temp% 目录,查看文件名以msi开头.log结尾的安装错误日志文件(随机名称,如MSIeb1c8.LOG) ...win7默认就会生成该文件,xp下据说需要设置点击打开链接

然后把上述代码WScript.CreateObject....的WScript删掉

Dim ret
Set WshShell = CreateObject("WScript.Shell") 
ret = WshShell.Run("msiexec /i mysql-connector-net-6.6.5.msi") 

2. 安装项目中的生成或提交阶段 执行以下vbs, wshShell.Run strCmd死活执行不成功...原因可能是虽然install.exe和mysql-connector-net-6.6.5.msi文件已经拷贝到安装目录了,但是这种状态还未提交,因此脚本还是找不到这两个文件

     Dim wshShell,strPath, strPathTarget, strCmd, fso
     'On error resume next
     Set wshShell = CreateObject("Wscript.Shell")
     Set fso = CreateObject("Scripting.FileSystemObject")
     strPath = Session.Property("CustomActionData") &"install.exe"  (install.exe即msiexec.exe)
     strPathTarget = Session.Property("CustomActionData") &"mysql-connector-net-6.6.5.msi"
     '这几个引号那是相当烦,就是把整个语句包在一对引号中
     strCmd = """"& strPath &" /i "& strPathTarget &""""  
     msgbox strCmd
     wshShell.Run strCmd
    ‘如果脚本改以下,文件路径存在,则安装包安装成功。
     wshShell.Run "E:\workstation\install.exe /i E:\workstation\mysql-connector-net-6.6.5.msi"

3. 变通的方法,把mysql-connector-net-6.6.5.msi拷贝到setup.exe/安装包目录下,就不打包到安装包里面了,用户执行安装包时,通过OriginalDataBase获取安装包路径,从而找出mysql-connector的绝对路径,然后执行之,WIN7下测试通过

     Dim wshShell,strSetupMsiPath, strDir, strExecPath, strExecTarget, strCmd, fso
     'On error resume next
     Set wshShell = CreateObject("Wscript.Shell")
     Set fso = CreateObject("Scripting.FileSystemObject")
	 'CustomActionData is [OriginalDatabase]
     strSetupMsiPath = Session.Property("CustomActionData") 
	 strDir = GetDir(strSetupMsiPath, "MealBookerSetup.msi")
	 
	 strExecPath = strDir &"install.exe"	
	 strExecTarget = strDir &"mysql-connector-net-6.6.5.msi"
	 strCmd =  strExecPath &" /i "& strExecTarget                    '把两边的双引号去掉
	 msgbox strCmd
	 wshShell.Run strCmd
     'wshShell.Run "msiexec.exe /i D:\Program Files\MealBooker\mysql-connector-net-6.6.5.msi"
   

     Private Function GetDir(fullpath, filename)
        dim pos
		pos = 0
		pos = instr(fullpath, filename)
		if pos>0 then
		    GetDir = left(fullpath, pos - 1)
		else
		    GetDir = ""
		end if
     End Function

参考资料

4. 按3的脚本生成的安装包在WIN7下OK,但xp下测试不通过,msixxx.log指示错误代码在

 wshShell.Run strCmd 

定位原因:

【XP】 我习惯把安装包目录放在桌面再执行setup.exe,此时读出来的路径是“C:\Documents and Settings\Administrator\桌面\test\XXX.exe”,中间有空格,而上述脚本没处理空格;再把安装包放在无空格的目录上,测试通过~~

【WIN7】桌面目录是“C:\Users\shiney\Desktop\”,没有空格...

PS: vbs带空格的字符串这玩意怎么处理要学习了...


5. 在文件系统视图中添加一个空文件夹,安装包不会在客户目录上生成该文件夹...

    我只能在里面增加一个无关文件了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值