Use Inno Setup to solve. NETFramework installation Issues

Source: Internet
Author: User
Tags java se

2010-03-01 09:59:26

Tags:. Net Framework Setup Leisure Inno original works, allow reprint, please be sure to use hyperlinks in the form of the original source of the article, author information and this statement. Otherwise, the legal liability will be investigated. http://zhoufoxcn.blog.51cto.com/792419/279243 some time ago a friend took a project, specifically to develop a LAN-installed software, the software will periodically connect to the local area network server to update some of the information on the native Client, because there are many different windowswindowsxpwindows2003 and windows2008windows7vs2008/.net framework2.0 development, because some systems are not installed by default .net  Framework2.0 there are several tools and scenarios for making a software installation package: One is to take advantage of Visual Studio 's own Installation kit authoring tool, and the other is to use InstallShield , a professional installation kit for this type of fee, and to use Inno Setup is a free, professional installation Kit maker. the installation package Maker tool, which was built with Visual Studio , was not deeply researched, and had previously tried to package the software into an installation file, but eventually failed, and then stopped studying;InstallShield This kind of charge installation package production software is really powerful, but it is not easy to get started, plus a charge (although can find cracked version, but always feel uncomfortable), and then seek to use Inno setup to solve. Inno Setupis a freeWindowsThe installer software, which supports all currently in useWindowsVersion: 7, R2, Vista, XP, 2003, 98, 95,AndNT 4.0 (No service pack Required)。 AndInno Setup1997 year, is a free open source software, even as a commercial use. The official website URL is http://www.jrsoftware.org Maple night Think rain ] inno setupinno setup.isl the way we think of this is to make the software an installation package, run the installation package and check if. NET Framework2.0 is installed on the client , and if not, download the . NET Framework2.0 from the server on the LAN. Install the file installation, and then continue to install and configure the developed software. Search the Web for a solution with the following code:[Code]
function Initializesetup:boolean;
var path:string;
Resultcode:integer;
Begin
If Regkeyexists (HKLM, ' software\microsoft\. netframework\policy\v2.0 ') Then
Begin
Result: = true;
End
Else
Begin
If MsgBox (' system detects that you are not installing. Net Framework2.0, do you want to download and install it now? ', mbconfirmation, mb_yesno) = Idyes Then
Begin
Path: = Expandconstant (' {pf}\internet explorer\iexplore.exe ');
Exec (Path, ' http://www.xxx.com/down/dotnetfx2.exe ', ' ', SW_SHOWNORMAL, ewwaituntilterminated, ResultCode);
MsgBox (' Please install the. Net Framework2.0 Environment, then run this installation package! ', MBINFORMATION,MB_OK);
Result: = false;
End
Else
Begin
MsgBox (' not installed. Net Framework2.0 Environment, unable to run the XXX program, this installer is about to exit! ', MBINFORMATION,MB_OK);
Result: = false;
End
End
EndThe purpose of this code is to check the registry to see if .net framework2.0 if not from http://www.xxx.com/down/dotnetfx2.exe download and prompt the user to install the downloaded .net  Framework2.0 After the program is installed. There is a merit in doing so, because not all machines are installed .net framework2.0 .net  framework2.0 package into the installation package, is the installation package is relatively small. However, in some cases there will be problems, such as the development of a good software, the user in the Office of the Internet and download and install the software, feel good, copy to the home without the internet on the machine can not be installed and used, so the trouble comes. So here's another workaround, which is to package. NET Framework2.0 into the installation file and check to see if the . NET Framework2.0 is installed on the client before the installationbegins . Net Framework2.0 installation files from the installation package extracted from the temporary folder and installed from the temporary folder, or directly installed after the development of the software, temporary folders under the file will be automatically when the system restarts the system to clean up, do not worry about taking up disk space. Here are some of the key codes:[Files]
.........
Source: "F:\ Zhou \dotnetfx20.exe column"; DestDir: "{tmp}"; Flags:ignoreversion
; Zhou Gong's Column Friendship tip: Dotnetfx20.exe will not be copied to the post-installation directory, but in the temporary directory, so that the restart of the machine will be deleted

[Code]
function Checkdotnet2_0 (): boolean;
Begin
Result:=not regkeyexists (HKLM, ' software\microsoft\. Netframework\policy\v2.0 ');
End

function Initializesetup (): Boolean;
var path:string;
Resultcode:integer;
Begin
If Checkdotnet2_0 () then
Begin
Extracttemporaryfile (' Dotnetfx20.exe ');
Exec (Expandconstant (' {tmp}\dotnetfx20.exe '), ', ', ', SW_SHOWNORMAL, ewwaituntilterminated, ResultCode);
End
EndThe code above ensures that theDotnetfx20.exeCopy to the post-installation folder,Visual StudioAndInstallShieldBelieve that there should be such a function, but the author did not find, this function I feel more practical, if the customer machine has been installed. Net Framework2.0Will not feel anything at the time of installation, if not installed, theDotnetfx20.exeRelease to the Temp folder and install from the Temp folder. Net Framework2.0, so as to ensureDotnetfx20.exeDoes not occupy the space of the installation folder. The advantage of making the installation package is that you do not have to worry about whether the user is networked when installing the software, but the disadvantage is that the installation file is slightly larger because the installation package contains a20ManyMOfDotnetfx20.exe, but in the network speed and storage devices are not the problem today, this is not too much of a problem, of course, is a bit uncomfortable, it may be developed by their own software only hundreds ofK, and must be accompanied by a20Manymdotnetfx20.exe*nix and windows java .net java.net exeIn fact, this practice can be used not only to detect the case of. NET Framework2.0, but also for other situations, such as detecting . NET Framework3.0 or . NET Framework3.5 , especially when you show your friends the WPF app you're developing, and you can also use it to deploy Java SE projects. Zhou Gong

Year 2 month date

Use Inno Setup to resolve. NETFramework Installation Issues

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.