Inno Setup 制作安装程序[支持静默安装.NET环境]
来源:互联网 发布:影音先锋网络任务清空 编辑:程序博客网 时间:2024/05/21 13:22
1.贴源码
; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
#define MyAppName "TestSet"
#define MyAppVersion "1.0"
#define MyAppPublisher "ZCF"
#define MyAppURL "http://www.zcfsky.com/"
#define MyAppExeName "TestApp.exe"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{A7293410-B577-4984-939A-4969DC799A5C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}/{#MyAppName}/测试程序/
UsePreviousAppDir=yes
DefaultGroupName=TestApp
AllowNoIcons=yes
OutputBaseFilename=setup
SetupIconFile=D:/安装程序/TestApp/book.ico
Compression=lzma
SolidCompression=yes
:管理员权限
PrivilegesRequired=admin
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,6.1
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "D:/安装程序/TestApp/TestApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:/安装程序/TestApp/TestApp.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:/安装程序/TestApp/readme.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:/安装程序/TestApp/include/dotnetfx.exe"; DestDir: "{tmp}"; Check:IsNeedInstall ; CopyMode:onlyifdoesntexist;Flags: ignoreversion deleteafterinstall
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”
[Icons]
Name: "{group}/{#MyAppName}"; Filename: "{app}/{#MyAppExeName}"
Name: "{group}/查看述文件"; Filename: "{app}/readme.txt"
Name: "{group}/{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}/{#MyAppName}"; Filename: "{app}/{#MyAppExeName}"; Tasks: desktopicon;
Name: "{userappdata}/Microsoft/Internet Explorer/Quick Launch/{#MyAppName}"; Filename: "{app}/{#MyAppExeName}"; Tasks: quicklaunchicon
[code]
var
isNeedDF : Boolean;
function IsNeedInstall():Boolean;
begin
isNeedDF := true;
if (RegKeyExists(HKLM, 'Software/Microsoft/.NETFramework/policy/v2.0')) then
begin
isNeedDF := false;
Result := false;
end
else
Result := true;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
pt:string;
ResultCode:Integer;
begin
if(CurStep=ssPostInstall) then
begin
if isNeedDF then
begin
pt:= ExpandConstant('{tmp}/dotnetfx.exe');
if(FileExists(pt)) then
begin
if(not Exec(pt,'/q:a /c:"install.exe /qb"','',SW_HIDE,ewWaitUntilTerminated,ResultCode)) then
begin
MsgBox('.NET运行环境安装失败,请手动安装!', mbInformation, MB_OK);
end;
end
else
begin
MsgBox('未找到文件'+pt, mbInformation, MB_OK);
end;
end
else
MsgBox('You Neednt Install .NET Framework 2.0', mbInformation, MB_OK);
end;
end;
[Messages]
BeveledLabel= CoSail Software Co,Ltd.
[Run]
Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: unchecked nowait postinstall skipifsilent
2.关键位置解释
[Tasks]代码段Flags: unchecked 去掉默认就是选择的
[Files]代码段中加上Check:IsNeedInstall ;就是一个检查是否处理的判断,其中IsNeedInstall是在[Code]代码段中自定义的一个函数。
[Run]代码段Flags加一个unchecked就是安装完毕,"运行本程序"不勾选,默认没有这一项。
- Inno Setup 制作安装程序[支持静默安装.NET环境]
- Inno Setup 制作安装程序[支持静默安装.NET环境]
- delphi Inno Setup 制作安装程序
- 利用Inno Setup制作补丁安装程序
- 使用Inno Setup制作安装程序
- Inno Setup 5制作安装程序
- 用inno setup制作安装程序
- 免费安装制作程序 Inno Setup
- Inno Setup制作安装包
- INNO setup 制作安装包
- Inno setup 制作安装包
- 程序发布系列 inno setup制作安装程序
- Inno Setup 制作的安装程序直接访问Access数据库
- 一分钟学会使用Inno Setup 制作安装程序
- Inno Setup制作安装包--调用外部程序
- Inno Setup制作安装包程序简单示例
- inno setup 安装 .net 服务
- Inno Setup制作实例:Inno Setup安装服务的代码
- WinSock学习笔记(一)
- Java中 堆 栈,常量池等概念解析(转载)
- 移动硬盘制作启动维护工具盘教程
- 初次邂逅 Pair Project —— 记与子禾童鞋的结对编程(附网站地址及完整源码)
- IMP-00002: 无法打开要读取的imp D:/admin.dmp
- Inno Setup 制作安装程序[支持静默安装.NET环境]
- 结构体学习网站
- 【ASP.NET】使用Stream方式上传文件(不用FileUpload),保存图像的缩略图
- 查看oracle数据库中所有的表及特定用户的表
- Hash表,链表实现
- [转]AMD flash擦除和编程源代码
- 每日一题:过桥问题
- Use Facebook Lint Tool to flush FB's page cache
- C How to program,Fifth Edition