Inoo Setup 打包 打包.net Winform 程序源代码
主要实现功能自动判断.net 和 sql Server 是否安装,如果没有安装,检测指定目录是否有安装文 件,如果没有自动打开网页,提供用户去下载,如果有的话,运行安装文件.
1. Inno Setup 下载
1. 官方下载 下载地址: jrsoftware.org/isinfo.php 2. 华军下载 下载地址: newhua/soft/4693.htm 3. 天空下载 下载地址: skycn/soft/5625.html
2.Inno Setup
源代码 ; 脚本由 Inno Setup 脚本向导 生成! ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助
文档! #define MyAppName "铭鑫 ERP 企业资源管理系统-辉煌终结版" #define MyAppVersion "1.1" #define MyAppPublisher "爱优科技" #define MyAppURL "example/" #define MyAppExeName "MingXinERP.exe" [Setup] ; 注: AppId 的值为单独标识该应用程序。 ; 不要为其他安装程序使用相同的 AppId 值。 ; (生成新的 GUID,点击 工具|在 IDE 中生成 GUID。) AppId={{D433B80A-1A26-49EA-9180-1A6217792256} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} AllowNoIcons=yes OutputDir=I:\outpu
OutputBaseFilename=setup SetupIconFile=I:\123\setup.ico Compression=lzma SolidCompression=yes [code] function Initializesetup :Boolean; var path:string; resultcode:integer; dotnetv2regpath:string; dotnetv2downurl:string; dotnetv2packpath:string; sqlserverregpath:string; sqlserverdownurl:string; sqlserverpackpath:string; begin dotnetv2regpath:='software\microsoft\.netframework\policy\v2.0'; dotnetv2downurl:='onlinedown.net/soft/38669.htm'; dotnetv2packpath:='{src}\runtime\dotnet 2.0\dotnetfx.exe'; sqlserverregpath:='SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS';
sqlserverdownurl:='skycn/soft/24562.html'; sqlserverpackpath:='{src}\runtime\sql server 2005 express\SQLEXPR.exe'; if regkeyexists(hklm,dotnetv2regpath) then begin if regkeyexists(hklm,sqlserverregpath) then begin path:=expandconstant('{pf}\铭鑫 ERP 企业资源
管理系统-辉煌终结版\App_Data'); if(fileordirexists(path)) then begin if msgbox('检测到本程序已经安装,是否覆盖安装,请覆盖安装前备份好数据!是否 继续?',mbconfirmation,mb_yesno)=idyes then begin result:=true; end else begin result:=false; end end else begin result:=true; end end else
begin if msgbox('检测到您的系统没有安装 SQL Server 2005 速成版,是否立即安装? ',mbconfirmation,mb_yesno)=idyes then begin path:=expandconstant(sqlserverpackpath); if(fileordirexists(path)) then begin exec(path,'/q','',sw_shownormal,ewwaituntilterminated,resultcode); if regkeyexists(hklm,sqlserverregpath) then begin result:=true; end else begin msgbox('未能成功安装 SQL Server 2005 速成
版,程序将无法运行,本安装程序即将退 出!',mbinformation,mb_ok); end end else begin if msgbox('软件安装目录中没有包含 SQL Server 2005 速成版安装程序,是否立即下载 后安装?',mbconfirmation,mb_yesno)=idyes then begin path:=expandconstant('{pf}\internet explorer\iexplore.exe'); exec(path,dotnetv2downurl,'',sw_shownormal,ewwaituntilterminated,resultcode); msgbox('请安装好 SQL Server 2005 速成版, 再运行本安装程序',mbinformation,mb_ok); end else begin msgb