vs2008开发的软件,有些机器没有安装framework3.5于是把framework下载到本地用inno setup打包软件进行打包。
现在的问题是:安装EXE文件时也判断出电脑是否已经安装过framework3.5 但要怎么实现去安装在EXE里的framework3.5文件?如果把framework3.5 文件与EXE 分离开 是可以的.
现在的问题是:安装EXE文件时也判断出电脑是否已经安装过framework3.5 但要怎么实现去安装在EXE里的framework3.5文件?如果把framework3.5 文件与EXE 分离开 是可以的.
Winform应用程序打包:
验证电脑是否已经安装过framework3.5的Code可以网上找找:
参考Framework2.0的
[Code]
function InitializeSetup:Boolean;
var Path:string ;ResultCode: Integer;
dotNetV2RegPath:string; dotNetV2DownUrl:string;
dotNetV2PackFile:string; begin dotNetV2RegPath:='SOFTWARE\Microsoft\.NETFramework\policy\v2.0';
dotNetV2DownUrl:='http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=zh-cn';
dotNetV2PackFile:='{src}\dotNetFx_v2.0(x86).exe';
if RegKeyExists(HKLM, dotNetV2RegPath) then begin Result := true;
end else begin if MsgBox('系统检测到您没有安装.Net Framework2.0运行环境,是否立即安装?',
mbConfirmation, MB_YESNO) = idYes then begin Path := ExpandConstant(dotNetV2PackFile);
if(FileOrDirExists(Path)) then begin Exec(Path, '/q', '',
SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
if RegKeyExists(HKLM, dotNetV2RegPath) then begin Result := true;
end else begin MsgBox('未能成功安装.Net Framework2.0运行环境,系统将无法运行,本安装程序即将退出!',mbInformation,MB_OK);
end end else begin if MsgBox('软件安装目录中没有包含.Net Framework的安装程序,是否立即下载后安装?', mbConfirmation, MB_YESNO) = idYes
then begin Path := ExpandConstant('{pf}\Internet Explorer\iexplore.exe');
Exec(Path, dotNetV2DownUrl , '',SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
MsgBox('请安装好.Net Framework2.0环境后,再运行本安装包程序!',mbInformation,MB_OK);
Result := false; end else begin MsgBox('不下载安装.Net Framework2.0运行环境,系统将无法运行,本安装程序即将退出!',mbInformation,MB_OK);
Result := false; end end end else begin MsgBox('没有安装.Net Framework2.0运行环境,系统将无法运行,本安装程序即将退出!',mbInformation,MB_OK);
Result := false; end; end; end;(其他的帮不上了)
这部分我已经实现了,
上面的是从网上下载的
我是已经下载到本地了,然后打包到EXE里了在安装EXE的时候就安装framework
有没有搞过 ? inno setup 不知道打包成EXE后 还可不可以访问framework文件?
请问你是不是使用 inno setup 实现了,把framework2.0安装包和winfrom打成了一个整体的EXE文件了?
如何实现的。
考虑在所有程序安装前先安装.Net Framework3.5,事先在需要安装的电脑上放置程序dotnetfx35.exe,由程序调用安装。INNO SETUP脚本如下:
function InitializeSetup: Boolean;
var Path:string ;
ResultCode: Integer;
dotNetV35PackFile:string;begin
if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\policy\v3.5')
then
begin
Result := true;
end
else
begin
if MsgBox('系统检测到您没有安装.Net Framework3.5,是否立即安装?', mbConfirmation, MB_YESNO) = idYes then
begin
dotNetV35PackFile:='{src}\dotnetfx35.exe';
Path := ExpandConstant(dotNetV35PackFile);
if(FileOrDirExists(Path)) then
begin
Exec(Path, '/q', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\policy\v3.5') then
begin
Result := true;
end
end
end
else
begin
MsgBox('没有安装.Net Framework3.5环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);
Result := false;
end;
end;
end;理论上来说,只要保证安装包文件和dotnetfx35.exe在同一路径下就可以执行。但实际安装过程中,从进程可看到dotnetfx35setup.exe和dotnetfx35.exe,但没有任何动静;如果手动安装,则进入extraction,继而安装。