Installation Package exe Creation

Source: Internet
Author: User

Preface:

Use the SmartInstallMaker installation package creation tool to complete the package. You must restore the database, create an IIS Site, and complete the creation of the package. It also involves creating users for computers, uploading or downloading folder permissions for users and sharing settings, creating and granting IIS virtual directories, and configuring users. The solutions for the above knowledge points are described below.

Overall Thinking: Computer User Creation ---> (write configuration of database, IIS, and several file permissions) ---> Read configuration DB restore ---> Read configuration forIIS site configuration, several file permissions ---> virtual directory creation and permission user ---> upload and download folder permissions and sharing ---> Delete DB, IIS site, installation folder (several) shared configuration ---> the installation is successful and the test is performed.

First, you can run the cmd command to add users, folder users, and shared settings to the computer.

Code

1 # region creates a FileUser password for the computer: sdzn123456 Add by: lei 2 3 System. diagnostics. process p = new System. diagnostics. process (); 4 p. startInfo. fileName = "CMD. EXE "; 5 6 p. startInfo. fileName = "cmd.exe"; 7 p. startInfo. useShellExecute = false; 8 p. startInfo. redirectStandardInput = true; 9 p. startInfo. redirectStandardOutput = true; 10 p. startInfo. redirectStandardError = true; 11 p. startInfo. createNoWindow = true; 12 p. start (); 13 14 15 p. standardInput. writeLine ("net user FileUser sdzn123456/add"); 16 p. standardInput. writeLine ("net localgroup administrators FileUser/add"); 17 p. standardInput. writeLine ("exit"); 18 19 p. waitForExit (); 20 21 # endregion

Set permissions and share

Permission and sharing Code

1 # region sets up all the permissions of the file sharing and fileuser for the uploadCenter file. Add by: LEI (Program. filepath: c: \) 2 3 System. diagnostics. process p2 = new System. diagnostics. process (); 4 p2.StartInfo. fileName = "CMD. EXE "; 5 6 p2.StartInfo. fileName = "cmd.exe"; 7 p2.StartInfo. useShellExecute = false; 8 p2.StartInfo. redirectStandardInput = true; 9 p2.StartInfo. redirectStandardOutput = true; 10 p2.StartInfo. redirectStandardError = true; 11 p2.StartInfo. createNoWindow = true; 12 p2.Start (); 13 14 string s = "\" "+ Program. filepath + "\" + "UploadCenter1" + "\" "; 15 16 p2.StandardInput. writeLine ("net share Upload =" + s + "/grant: fileuser, full"); 17 p2.StandardInput. writeLine ("exit"); 18 19 p2.WaitForExit (); 20 21 # endregion

2. Create iis virtual directories and configure users. (You can search for many solutions online. For more information, see this article. Thank you)

 

Third: configure write permissions for DB, iis, and files (Note: path and parameters)

Take DB configuration as an example:

Actually: Use the set_value method in an Ini class

Fourth: Read the preceding three configurations and perform DB restoration respectively. IIS Site creation folder permission Configuration

Take DB as an example:

DB restoration Code

1 System. diagnostics. process exep1 = new System. diagnostics. process (); 2 exep1.StartInfo. fileName = Program. filepath + @ "\ Web \ setup \ automatically configure data warehouse _console v1.0_20120502.exe"; 3 exep1.StartInfo. windowStyle = System. diagnostics. processWindowStyle. minimized; 4 exep1.StartInfo. createNoWindow = false; 5 exep1.StartInfo. useShellExecute = false; 6 exep1.Start (); 7 exep1.WaitForExit ();

Actual: The External exe applet is called for restoration (the specific applet function backs up, restores, deletes, and other operations based on different input parameters)

Fifth, delete the three configuration files and directly Delete the folder where the files are located (Note: Path)

Directory. Delete (Program. filepath + @ "\ Web \ setup", true );

 

Summary:

1. It takes a lot of time to create and configure virtual directories, mainly because of limited online search materials and the authenticity of materials.

2. Do as much as possible to create computer users and share permissions with the Program (cmd), instead of the operations of implementers.

3. Learning the idea of calling external exe.

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.