NSIs: An Example of judging and installing. NET Framework

Source: Internet
Author: User
NSIs: An Example of judging and installing. NET Framework

Currently, software developed by. NET is widely used, but some operating systems do not meet the running requirements of the software. Therefore, we need to installProgram. NET Framework. If it does not meet the requirements, install it silently. 

First, we will judge the current. Net version in the function section:

Function getnetframeworkversion
; Obtain the. NET Framework version. Supported
Push $1
Push $0
Readregdword $0 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ v3.5" "Install"
Readregdword $1 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ v3.5" "version"
Strcmp $0 1 knownetframeworkversion + 1
Readregdword $0 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ V3.0 \ setup" "installsuccess"
Readregdword $1 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ V3.0 \ setup" "version"
Strcmp $0 1 knownetframeworkversion + 1
Readregdword $0 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ v2.0.50727" "Install"
Readregdword $1 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ v2.0.50727" "version"
Strcmp $1 "" + 1 + 2
Strcpy $1 "2.0.50727.832"
Strcmp $0 1 knownetframeworkversion + 1
Readregdword $0 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ v1.1.4322" "Install"
Readregdword $1 HKLM "SOFTWARE \ Microsoft \ Net Framework Setup \ NDP \ v1.1.4322" "version"
Strcmp $1 "" + 1 + 2
Strcpy $1 "1.1.4322.573"
Strcmp $0 1 knownetframeworkversion + 1
Readregdword $0 HKLM "SOFTWARE \ Microsoft \. netframework \ Policy \ V1.0" "Install"
Readregdword $1 HKLM "SOFTWARE \ Microsoft \. netframework \ Policy \ V1.0" "version"
Strcmp $1 "" + 1 + 2
Strcpy $1 "1.0.3705.0"
Strcmp $0 1 knownetframeworkversion + 1
Strcpy $1 "not. netframework"
Knownetframeworkversion:
Pop $0
Exch $1
Functionend

Then, perform. Net Silent Installation in the section.

Section-. net
Call getnetframeworkversion
Pop $ r1
$ {If} $ R1 <'2. 0.50727'
Setdetailsprint textonly
Detailprint "Installing. NET Framework 2.0 SP2 ..."
Setdetailsprint listonly

Setoutpath "$ Temp"
Setoverwrite on
File "netfx20sp2_x86.exe"
Execwait '$ Temp \ netfx20sp2_x86.exe/quiet/norestart' $ r1
Delete "$ Temp \ netfx20sp2_x86.exe"
$ {Endif}
Sectionend

Of course, the Section section can be automatically downloaded online without hitting. net in the installation package. This can reduce the size of the installation package. For more information, see the zichen account book installer.

 

Reprinted from: http://www.flighty.cn/html/bushu/20110527_126.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.