How does VB. NET run on a machine without a. NET Framework?

Source: Internet
Author: User

Create your own Installer

In VS. NET, we can create a "Setup and Deployment Projects" project to flexibly and conveniently create a. NET program as a Windows Installer file. 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 double-click the file to open it with your own program.


3. Registry Processing

At the MSDN site below, we can get an example of creating our own installer via Setup and Deployment Projects in VS. NET: http://msdn.microsoft.com/library/en-us/vsintro7/html/vbconDeploymentScenarios.asp


Release. NET Framework

. NET Framework 1.0 provides an exe file for re-deploying. NET: Dotnetfx.exe. It contains the Common Language Runtime and other content that is essential for. NET program running.

We can download this exe file from the following site: asp? Url =/MSDN-FILES/027/001/829/msdncompositedoc. xml "> http://msdn.microsoft.com/downloads/sample.asp? Url =/MSDN-FILES/027/001/829/msdncompositedoc. xml

At the same time, we can find this file in VS. NET installation CD or DVD.

We can use multiple methods to deploy the. NET Framework to the target machine by running dotnetfx.exe:

1. deployed through Microsoft Systems Management Server.

2. Deploy through Active Directory.

3. Use third-party tools.

For more information, see the following article:
Html/redistdeploy. asp "> http://msdn.microsoft.com/library/en-us/dnnetdep/html/redistdeploy.asp

Create your own native Installer

If we want to put our own.. NET Program released to the target machine, and we are not sure whether the target machine has been installed. NET Framework, then we need to design a piece of unmanaged code to determine whether the target machine is installed.. NET Framework. If not, install dotnetfx.exe.. NET Framework, and then use Windows Installer to install your own program.

On the following MSDN page, we can obtain an unmanaged C ++ installation program 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 csetaskclass, read "settings. ini" to download your desired msiinstallation file and the dotnetfx.exe path.
Path and other settings. (For example, the. NET Framework language version)
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 to install. NET Framework. fxinstallrequired()) dodododoand dotnetfx.exe.
HKLMSOFTWAREMicrosoft. NETFrameworkpolicyv1.0

3. If you need to install the. NET Framework, use the following command to install dotnetfx.exe: dotnetfx.exe/q: a/c: "install/l/q" in strongswan execute (example"

4. Call the following command in the ExecCmd () global function to install your own MSI file: msiexec/I REBOOT = ReallySuppress

Usage

If we use the above native code as our own installer, we can combine our. NET program with it through the following steps:

1. Make your own. NET program into a Windows Installer (. MSI) file.

2. Open the "settings. ini" file, set the Msi file path and file name for your own. NET program in the "MSI" key, and set the dotnetfx.exe path in the "FxInstallerPath" key. For more information about the parameters, see the following article:
Http://msdn.microsoft.com/library/default.asp? Url =/library/en-us/dnnetdep/html/redistdeploy. asp

3. set "setup.exe", "settings. ini "," dotnetfx.exe "and your own MSI installation file are sent to the target machine, and then run" setup.exe ". The installer automatically checks whether there is any. NET Framwork. If not, run dotnetfx.exe first.

Summary

After completing the preceding steps, you can successfully deploy your. NET program to a machine without the. NET Framwork environment.

Related Article

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.