Deploy the. NET program to a machine that does not have the. NET Framwork installed

Source: Internet
Author: User
Tags exit ini
Program
Directory

The content of this article
Make your own setup program
Publish the. NET Framework
Make your own native Setup program
How to use
Summarize
Author

--------------------------------------------------------------------------------

The content of this article

1. Use Vs.net to make the installer.

2. How to deploy the. NET Framework to the target machine.

3. How to use the native code to make the. NET framework and its own installer a unified setup program. The program does this if the. NET Framework is not on the target machine, the. NET Framework is automatically installed and then the author's own program is automatically installed.


--------------------------------------------------------------------------------

Make your own setup program

In Vs.net, we can create "Setup and Deployment Projects" project, very flexible and convenient to put their own. NET program made for Windows Installer files. For example, we can easily customize the following options:

1. Whether to place shortcuts on the desktop.

2. Register your own file type, you can open it using your own program by double-clicking the file.

3. Processing of the Registry

At the following MSDN site, we can get an example of installing your own installer in vs.net through the setup and deployment projects:

Http://msdn.microsoft.com/library/en-us/vsintro7/html/vbconDeploymentScenarios.asp


--------------------------------------------------------------------------------

Publish the. NET Framework

The. NET Framework 1.0 provides one for redeployment. NET EXE file: Dotnetfx.exe. It contains what common Language runtime and other. NET programs are essential to run.

We can download the exe file from the following site:

Http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/829/msdncompositedoc.xml

At the same time, we can also find the file on the Vs.net installation CD or DVD.

There are several ways to deploy the. NET framework to the target machine by running Dotnetfx.exe:

1. Deploy via Microsoft Systems Management Server.

2. Deployed through Active Directory.

3. Use third party tools.

For specific information, we can refer to the following article:

Http://msdn.microsoft.com/library/en-us/dnnetdep/html/redistdeploy.asp


--------------------------------------------------------------------------------

Make your own native Setup program

If we're going to put our own. NET program is posted to the target machine, and we are not sure if the target machine has the. NET Framework installed, then we need to design a unmanaged code to determine if the target machine has the. NET Framework installed, and if not, You run Dotnetfx.exe to install the. NET Framework and then use Windows Installer to install your own programs.

On the following page of MSDN, we can get an installer with unmanaged C + + implementation and its source code:

Http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/830/msdncompositedoc.xml

1. In Csettings class, Get your own MSI installation files and Dotnetfx.exe paths, and other settings yourself, by reading "Settings.ini". (for example, the language version of the. NET framework)

GetCaptionText (void)

Getdialogtext (void)

Geterrorcaptiontext (void)

Getininame (void)

Getproductname (void)

The Parse () function is used to parse the Settings.ini file.

2. In the Main.cpp file, the global function fxinstallrequired () determines whether the. NET Framework is to be installed on the target machine. Fxinstallrequired () detects the following registry key values and Dotnetfx.exe version and language settings.

Hklm\software\microsoft\. netframework\policy\v1.0

3. If you need to install the. NET Framework, call the following command in the global Function ExecCmd () silent Install Dotnetfx.exe:

DOTNETFX.EXE/Q:A/C: "INSTALL/L/Q"

4. In the ExecCmd () global function, call the following command to install your own MSI file:

msiexec/i <your MSI file> reboot=reallysuppress


--------------------------------------------------------------------------------

How to use

If we use the above native code as our own installer, then we can take our own in the following steps. NET program is combined with it:

1. Put your own. NET program made into Windows Installer (. MSI) file.

2. Open the "Settings.ini" file and set your own in the "Msi" key. NET program's MSI file path and filename, and in the "Fxinstallerpath" key, set the path of the Dotnetfx.exe. Specific parameter information, you can get from the following article:

Http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/redistdeploy.asp

3. "Setup.exe", "Settings.ini", "Dotnetfx.exe" and your own MSI installation files, sent to the target machine, and then run "Setup.exe", the installer automatically detects if there are. NET Framwork, If not, the Dotnetfx.exe is run first.

Through the steps above, you can put your own. NET program is successfully deployed to a machine that does not have the. NET framwork environment installed.


--------------------------------------------------------------------------------

Summarize

Through the steps above, you can put your own. NET program is successfully deployed to a machine that does not have the. NET framwork environment installed.



The following is a development guide on CSDN

Using Setup.exe to install bootstrapper samples with applications

The actions performed by the Setup.exe installation Bootstrapper sample are automatic. However, to enable Setup.exe to use the application, you must create a custom Settings.ini file that provides the necessary information about your application. In addition, it is recommended that you deploy a setup program with a Readme file that provides users with the minimum requirements for installing applications and Dotnetfx.exe. The following topics provide more information about creating Settings.ini and Readme files.


Creating Settings.ini Files

The Setup.exe installation Bootstrapper example uses an external file Settings.ini to determine the following:

· Location of Dotnetfx.exe and host applications.

· The language version of the. NET Framework to check.

· The custom string to use for the Setup.exe dialog box.

The default location for Settings.ini is in the same folder as Setup.exe. You are responsible for creating the Settings.ini file, which enables the Setup.exe installation Bootstrapper sample to work with your application. You can copy the Settings.ini file provided with the Setup.exe installation Bootstrapper sample, and then edit the file as needed to specify the correct value for the application.

Specifying the location of Dotnetfx.exe and host applications

The Setup.exe installation Bootstrapper sample requires Dotnetfx.exe and host. NET Framework applications to be located in a known location relative to Setup.exe. The Setup.exe installation Bootstrapper example uses an external file Settings.ini to determine the location of the Dotnetfx.exe and host applications. You can copy the Settings.ini file provided with the sample, and then edit the file to point to the location of the. NET Framework host application and Dotnetfx.exe.

The following Settings.ini file example shows how to point to a host of. NET Framework applications and Dotnetfx.exe Windows Installer packages (. msi files) for different locations (as opposed to Setup.exe locations).

The following example Settings.ini file points to a Windows installer package that is a. NET Framework application Mysetup.msi and Dotnetfx.exe in the same folder as Setup.exe. The single quote "'" is used to annotate rows that are not customized.

[Bootstrap]

Msi=mysetup.msi

' Languagedirectory=

Productname= my Application

' Dialogtext=

Captiontext=my Application

errorcaptiontext= My application Error

Fxinstallerpath=c:\myprojectfolder\

The following example Settings.ini file points to a Windows installer package that is not in the same location as Setup.exe, where the. NET Framework application Mysetup.msi and Dotnetfx.exe are located on a network share.

[Bootstrap]

Msi=\\mynetworkshare\myprojectfolder\mysetup.msi

' Languagedirectory=

Productname=my Application

' Dialogtext=

Captiontext=my Application

errorcaptiontext= My application Error

Fxinstallerpath=\\mynetworkshare\myprojectfolder\

The following example Settings.ini file points to a Windows installer package that is a. NET Framework application Mysetup.msi and Dotnetfx.exe that are located on the same computer as Setup.exe, but different folders.

[Bootstrap]

Msi=c:\myinstallerfiles\mysetup.msi

' Languagedirectory=

Productname= my Application

' Dialogtext=

Captiontext=my Application

errorcaptiontext= My application Error

Fxinstallerpath=c:\myexecutables\

The following example Settings.ini file points to a Windows installer package for. NET Framework Applications Mysetup.msi and Dotnetfx.exe that are located in different folders on the same CD as Setup.exe.

[Bootstrap]

Msi=myinstallerfiles/mysetup.msi

' Languagedirectory=

Productname= my Application

' Dialogtext=

Captiontext=my Application

errorcaptiontext= My application Error

fxinstallerpath=myexecutables/

Specify language version

If you want Setup.exe to check the build number and language version of the. NET Framework, you must specify the culture name of the language in the Settings.ini file. If you do not specify a culture name, by default Setup.exe will check for an English language version.

The following table lists the available language versions and the appropriate culture names to be specified in the Settings.ini file. Culture names are case-insensitive.

Language
Culture name

Chinese (Simplified) CHS

Chinese (Traditional) cht

French FR

German de

Italian it

Japanese ja

Korean KO

Spanish ES


The following example Settings.ini file instructs Setup.exe to check the French version of Dotnetfx.exe.

[Bootstrap]

Msi=mysetup.msi

Languagedirectory=fr

Productname= my Application

' Dialogtext=

Captiontext=my Application

errorcaptiontext= My application Error

Fxinstallerpath=c:\myprojectfolder\

To customize the string used for the Setup.exe dialog box

You can edit the following variables in the Settings.ini file to customize the string displayed in the Setup.exe dialog box.

ProductName

Specifies the name of the. NET Framework application that Setup.exe will install. The product name you specify is used to customize the text in the dialog box that appears after you start Setup.exe. For example, if you designate ProductName as my application, the dialog box text is "To start my application installer," click OK. To exit without installing, click ' Cancel '.

If you do not have a custom captiontext variable, ProductName is also used to customize the title bar of the dialog box that is displayed after Setup.exe startup. For example, if you designate ProductName as my application, the title bar displays "My Application installer." If you also customize ProductName and captiontext,captiontext to customize the title bar text in this dialog box.

ProductName is also used to customize the title bar text in the Success dialog box that is displayed when you finish installing the application. If you do not have a custom ProductName, the default text "Application Installer" is displayed.

DialogText

Specifies the custom text to display in the dialog box that is displayed after Setup.exe startup. If you do not have a custom dialogtext, display the default text "to start the application installer," click ' OK '. To exit without installing, click ' Cancel '.

CaptionText

Specifies the custom text to display in the title bar of the dialog box that appears after Setup.exe startup. If you do not have a custom captiontext, the ProductName is displayed. If you do not have a custom ProductName, the default text "Application Installer" is displayed.

ErrorCaptionText

Specifies the custom text to display in the title bar of the Setup.exe error dialog box. If you do not have a custom errorcaptiontext, the default text "Application Installer Error" is displayed.

To create a Readme file for the installer

It is recommended that you distribute the installer with a Readme file that lists the minimum configuration requirements for the computer that can successfully run the Setup program. List at least Microsoft Windows 98 or later that are installed with Internet Explorer 5.01 or later, as required before installation. You should also list MDAC 2.6 or later and note that it is not required for installation, but is required for. NET Framework applications that provide data access. For more information about the minimum configuration requirements for installing Dotnetfx.exe,






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.