NSIS script - download .NET framework, DirectX

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 11:35:59

Here's an example for .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

For DX, you can use dxwebsetup.exe as a bootstrap. It's a small installer, which scans the user's system and then downloads required components:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displaylang=en

Not sure if there's a similar web installer for the regular .net framework, but at least that's half the battle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!