NSIS脚本-下载.NET框架,DirectX

4

一个NSIS脚本可以从微软下载.NET和DirectX,然后安装吗?

我不想在我的安装程序中包含这些安装程序,因为它们太大了。

3个回答

4
这是一个关于 .Net 的示例:

以下是代码:

Function GetDotnet ;// looks for local copy before downloading, returns path in $0
    Pop $0
    ${If} ${FileExists} "$InitDir\dotnetfx35.exe"
        StrCpy $0 "$InitDir\dotnetfx35.exe"
    ${ElseIf} ${FileExists} "$InitDir\dotnetfx35setup.exe"
        StrCpy $0 "$InitDir\dotnetfx35setup.exe"
    ${Else}         
        Call DownloadDotnet
        StrCpy $0 $0
    ${EndIf}
    Push $0
FunctionEnd

Function DownloadDotnet ;// downloads .Net, returns download path in $0
    NSISDL::download "${DotnetDownloadUrl}" "${TempDir}\dotnetfx35setup.exe"
    Pop $0  
    ${If} $0 == "cancel"
        Quit    
    ${EndIf} 
    StrCpy $0 "${TempDir}\dotnetfx35setup.exe"
    Push $0
FunctionEnd 

Function InstallDotnet ;// kicks off the .Net installer
    Pop $0
    Push $1 
    ExecWait '"$0" /norestart' $1       
FunctionEnd

0

我想在安装过程中下载文件,而不在我的8MB安装程序中包含DirectX或.NET框架。 - Kevin
这里提到的文件不是完整的安装程序,而是网络安装程序。 - Dave

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接