.NET vs installer安裝項目失敗匯總

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   使用   io   ar   檔案   

1. 提交階段,使用vbs調用mysql-connector-net-6.6.5.msi報錯

vbs 指令碼如下:

Dim retSet 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 retSet 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 (strCmd本身就是string,故程式碼片段2中這部分也是有問題的,應把兩邊的雙引號去掉) 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 pospos = 0pos = instr(fullpath, filename)if pos>0 then    GetDir = left(fullpath, pos - 1)else    GetDir = ""end if     End Function

參考資料








.NET vs installer安裝項目失敗匯總

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.