Make your own installationProgram
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
On the following msdn site, we can get an example of creating our own installer through 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: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, seeArticle:
Http://msdn.microsoft.com/library/en-us/dnnetdep/html/redistdeploy.asp
Create your own native Installer
If we want to release our. Net program to the target machine, and we are not sure whether the target machine has installed. NET Framework, we need to design a piece of unmanagedCodeTo determine whether the. NET Framework is installed on the target machine. If not, run dotnetfx.exe to install. NET Framework, and then use Windows installer to install your own program.
On the following msdn page, we can get an unmanaged C ++ installation program and itsSource 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.
HKLM/software/Microsoft/. netframework/policy/V1.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.