利用InstallShield 2008 制作安装包

1.       新建一个 InstallScript Project;

2.       在Project Assistant页面中设置安装包的相关信息,主要如下:

在Application Information中,填入公司名称、应用软件名称及公司网址;

在Application Files中将需要打包的软件和图标添加进去,并检测其所依赖的DLL;

在Application Shortcuts中将打包的软件重命名并设置快捷方式的位置;

在Installation Localization中设置安装包语言,一般设置为简体中文和英文;

在Build Installation中将Single Executable复选框选中,并Build Installations。

3.       在Installation Designer页面中设置快捷方式、检测是否安装.net framework 2.0、卸载快捷方式,主要过程如下:

在Installation Information -> String Tables,点击Chinese(Simplified),右键选择Make default,将默认语言设置为简体中文;

在System Configuration -> Shortcuts设置快捷方式的相关信息,主要是Display Name和Icon File;

在Behavior and Logic -> Support File/Billboards -> Language Independent,添加.net framework 2.0安装软件;

4.       在Behavior and Logic -> InstallScript添加卸载快捷方式和检测是否安装.net framework 2.0 的代码。

添加卸载快捷方式代码如下:

export prototype CreateUninstallShortcut();       //快捷方式函数声明

   function CreateUninstallShortcut()   //快捷方式函数定义

             string strCmdLine, strProductFolder, strIconPath, strItemName;

begin  

             strCmdLine = UNINSTALL_STRING ^ " -removeonly";

             strProductFolder = \\test\\test;

             strIconPath = TARGETDIR ^ "\logo.ico";

strItemName = "卸载" + "test";

             // Create the shortcut.

             AddFolderIcon(FOLDER_PROGRAMS ^ strProductFolder,

                      strItemName, strCmdLine,

                      "", strIconPath, 0, "", NULL );

end;

 

检测是否已经安装.NET Framework 2.0,如已安装,则提示“.net framework 2.0已安装”,否则装.net framework 2.0。代码如下:

RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

if ( RegDBKeyExist ("SOFTWARE\\Microsoft\\.NETFramework\\policy\\v2.0" ) < 0) then

SprintfBox(MB_OK,".NET安装","尚未安装.net framework 2.0 !\n请点击“确定”以继续安装!");       

if( LaunchAppAndWait( SUPPORTDIR ^ "Microsoft_DotNetFXCHS2.exe" , "/q:a/l" ,WAIT) < 0) then

          SprintfBox(MB_OK,".NET安装","安装.net框架时发生意外,请重新安装!");

endif;

else

     SprintfBox(MB_OK,".NET安装",".net framework 2.0已安装!");

endif;

你可能感兴趣的:(.net,框架,Microsoft,prototype)