Enable .Net Framework 3.5 SP1 from 'Programs and Features' and install it using NSIS

Viewed 3841

I am creating installer using nsis for my windows form application. I need .Net Framework 3.5 SP1 as pre-requisites for my application. So using NSIS i check if it is available in client machine or not. If not then it will install it silently. But it gives me an error. I know .Net Framework 3.5 SP1 is required to enable from 'Program and Features' in control panel.

So how can i enable feature '.NET FRAMEWORK 3.5' from control panel using NSIS script.

My nsis section to check and install .Net Framework 3.5 SP1 is :

 section
    SetOutPath "$temp\Pre_requisites"
    ; check and install .Net Framework 3.5SP1
    ReadRegStr $R1 HKLM "Software\Microsoft\NET Framework Setup\NDP\v3.5" "SP"
    ${If} $R1 != "1"
                   DetailPrint "Microsoft .NET Framework 3.5 SP1 needed. Installing..."              
                   File "$temp\Pre_requisites\dotnetfx35.exe"      
                   ExecWait '"$temp\Pre_requisites\dotnetfx35.exe" /q /norestart'
    ${Else}
    DetailPrint "Microsoft .NET Framework 3.5 SP1 Found."
    ${EndIf}
 sectionend

Error message is(I have tried this in windows 7 SP1 64bit):

enter image description here

Thanks..!

2 Answers
Related