1. 程式人生 > >InstallShield 2013 Limited Edition for Visual Studio

InstallShield 2013 Limited Edition for Visual Studio

新建打包專案後,解決方案資源管理器中的結構如下:

Project Assistant介面如下:

在Project Assistant中按照步驟建立打包專案:

1、Application Information 中填寫公司名稱、產品名稱、版本號、網址的資訊。

  Application Information 左側視窗點選 General Information 中設定其他資訊,主要配置如下:

(1)General -> Setup Language:設定安裝語言

(2)General -> INSTALLDIR:設定安裝路徑

(3)General -> Fast Install:根據需要配置以便加速安裝速度

  a、No system restore point is saved for this installation:沒有為這個程式儲存系統恢復點

  b、Perform only File Costing and skip checking other costs:僅執行檔案花費和跳過檢查其他成本

  c、Reduce the frequency of progress messages:降低進度條資訊的頻率

(4)Summary Information Stream -> Require Administrative Privileges:設定管理員許可權

  將該項設為“Yes”。這樣設定之後,使用者就可以有管理員的許可權去安裝該安裝檔案了,避免使用者在安裝的時候出現許可權不夠的問題。

(5)Add or Remove Programs -> Disable Change Button, Disable Remove Button, Disable Repair Button,這三個至少要有一個選為“NO”,全部設為“YES”的話,則在控制面板中,對應的軟體沒有“更改/刪除”的按鈕可以點選,即在這裡就解除安裝不了軟體了。

2、Installation Requirements:選擇程式執行的作業系統及需要的軟體

  可選的軟體有Adobe Reader、.NET Framework、IE、Office等

3、Installation Architecture:可配置全部安裝,或是部分安裝

4、Application Files:新增要打包的檔案

  Destination Computer:右鍵 Show Predefined Folder 可選擇需要的資料夾,例如Font資料夾,將字型檔案加入該資料夾,安裝時會自動安裝字型。

  新增完檔案後,全選檔案,右擊,選中“Always Overwrite”。否則有時會出現重新安裝後,有些檔案沒有被覆蓋。(InstallShield Limited edition沒有這項許可權)

  新增完檔案後,還需要新增C:\Windows\System32\msiexec.exe,用於新增解除安裝程式的快捷方式。

5、Application Shortcuts:建立桌面和開始選單的快捷方式

  點選左側的Shortcuts,可配置快捷方式的屬性資訊。  

  解除安裝程式的快捷方式設定引數以實現解除安裝功能:Behavior -> Argument 設定為“/x {Product Code}”

6、Application Registry:添加註冊表

7、Installation Interview:配置安裝介面

  Do you want to display a License Agreement Dialog:配置License介面

  Do you want to prompt users to enter their Company Name and User Name:配置是否展示輸入公司名稱和使用者名稱稱的介面

  Do you want your uses to be able to modify the installation location:配置使用者是否可以修改安裝路徑

  Do you want users to be able to selectively install only certain parts:配置使用者是否可以選擇安裝的模組

  Do you want to give users the option to launch your application when the installation:配置使用者是否可以在安裝結束後選擇啟動應用程式

  點選左側的 Dialogs 可詳細配置安裝介面是否顯示及具體內容。

8、將需要的其他工具一起打包到安裝程式中:解決方案中 Specify Application Data -> Redistributables 可選擇要打包的程式

9、設定安裝程式的生成路徑及方式:解決方案中 Prepare for Release -> Releases

  CD-ROM:可生成 msi、exe 安裝包。

  若Build -> Compression的值為UnCompressed,則完整的安裝程式為program files資料夾+msi檔案。

  若Build -> Compression的值為Compressed,則完整的安裝程式為cab檔案+msi檔案。

  SingleImage:只能生成 exe 安裝包,也可配置Build -> Compression。

  CD-ROM 或 SingleImage 中選擇 Setup.exe -> InstallShield Prerequisites Location,設定為 Extract From Setup.exe

  安裝程式的生成路徑為:\Express\CD_ROM\DiskImages\DISK1 或 \Express\SingleImage\DiskImages\DISK1

  可在VS上方的工具欄中選擇生成方式。

打包過程中碰到的問題:

1、程式中有一個專案新增上後,打包就會失敗,後檢查發現是一個類中有一下未使用的程式碼,遮蔽後就解決了。原因未知。

[System.Runtime.InteropServices.DllImport("user32.dll ")]
static extern IntPtr GetWindowDC(IntPtr hWnd);

[System.Runtime.InteropServices.DllImport("user32.dll ")]
static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

2、使用快捷方式解除安裝軟體時,提示“安裝程式必須更新在系統執行時無法更新的檔案或服務。如果選擇繼續,將需要重新啟動以安裝程式。”,點選“確定”後,機器未重啟,軟體成功解除安裝。原因未知。

3、打包時要關閉打包程式下的DiskImages資料夾,否則會導致生成失敗。