①
1. solution-add-new project-Other project types-installation and deployment-installation project, enter the name setup, and click "OK"
2. Add primary output: click "application folder" on the left, right-click "add"> "project output"> "main output" on the right, and click "OK.
3. Add a folder in the Start Program. Right-click "user program menu"-"add"-"folder" on the left and set the name by yourself.
4. Add the shortcut for the Start Program and the desktop as follows: right-click the folder you just created on the left-right-click on the right-click the folder and choose "application folder"> "main output"> "OK". Right-click the user desktop on the left-right-click the folder on the right-click the folder to create a new shortcut. method --- application folder --- main output --- OK
5. Set the program icon: Put the icon file under your program directory first --- click "application folder" on the left, --- Right-click in the blank area and choose "add"> "file"> "icon file. Then, click the folder under the "user program menu" on the left-side, and click the newly created program shortcut-Properties window-icon-browse-icon file-OK. Similarly, add the shortcut icon in "User desktop.
6. Add the uninstall function: Find the msiexec.exe file under the c: \ windows \ system32 folder, copy it to the program directory, and add it to the "Application folder" by using the icon, then, add the uninstall shortcut in the Start program just like adding the shortcut for the main program. You can set the name yourself. Click "setup" in "solution manager", that is, your installation project. In the Properties window, locate "productcode" and copy the value following it, click the new unload shortcut, find "arguments" in the property, and enter "/X" in the subsequent box, and add the copied value.
7. You can set the content of "productname" and "title" in the setup attribute;
8. Modify the default installation path: click "application folder" on the left, and "defaultlocation" in the property will delete the "[manufacturer]" in the middle, otherwise, your user name will appear in the installation path.
9. Add system essentials: Right-click setup-properties-system essentials, in "specify the installation location of required system components", select "download required system components from the same location as my application", and then click OK.
10. Generate the installation project: Right-click "setup"-Generate. Wait a moment. OK. It's done! Then you can see the "setup" folder in your project folder and the installation file under "debug!
②
I. Application folder operations
1. Create an installation project named "test package"
Remember the path here. Otherwise, you won't be able to find the installation package after the installation package is finished!
2. Three folders will appear here. You don't have to go over them to understand them. Click "application folder --> Add --> folder ".
The role here is to manage the package and restart the name. Here I will call it "test the packaging system"
3. Right-click the "test Packaging System" folder and choose "add"> "project output ".
Next step: add primary output
Generally, this is enough. Of course you have other resources to add!
4. Create Several folders under "application folder". I have created three
In images, I put images, 2 ICO and 1 BMP, which will be used later!
Unit: place the unmounted file. Here you can remember this. Here we will talk about how this file came about!
You don't need to talk about the bottom one. The above operations have been done, and a primary output file is put!
Here, a simple packaging project has been completed. Right-click to generate it and find the installation file in the project directory to run and install it!
However, after installing such an installation package, you cannot find the installation path, what we are familiar with is that there is nothing on the Start menu and the desktop! Not convenient. Add it!
2. Add content in the Start Menu> program>
1. Click "user's" program "menu to create a folder! The steps are the same as before. Do not elaborate!
My name is "test Packaging System"
2. Right-click the table in the middle of the table (under the name) and choose create shortcut. The following interface is displayed.
Select the "Application folder", that is, the primary output file we added!
3. Change the newly added "shortcut attributes"
Now, I have changed the name and icon here, and changed the icon. Now I have browsed the icon. Just click the ICO file under the images above!
4. Create a shortcut in the same way as above and point to the file in the unit folder added above! Change the attributes!
See it. I have two shortcuts in it!
This is OK! After the installation is complete, the two shortcuts added above will appear in the Start menu!
3. add content to a user's desktop
1. Add a shortcut in the middle window of the folder, point to the main output in the "Application folder", and change the properties to OK!
After the installation is complete, a quick start will appear on the desktop!
Here, an installation and deployment project is almost the same, but is it far from perfection? Write out what I have mastered first.
4. Custom User Interface
1. Open the user interface
2. You can set the attributes of an existing form and add a new form.
Set form attributes
For example, you can set the bannerbitmap here. The image above the installation window is the same as the previous ICO file. Just browse to the BMP file under images!
That's the effect. Haha, the effect is worse!
You can add new windows as needed, such as passwords.
Is the window above
5. How can I package the uninstall program?
I have tried several ways, but I may not understand it! I finally used this method, and it feels pretty good!
1. Create a console Program
2. Check the code
Code
Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Namespace uninstall
{
Class Program
{
Static void main (string [] ARGs)
{
String sysroot = system. environment. systemdirectory;
System. Diagnostics. process. Start (sysroot + "\ msiexec.exe", "/X {522b529d-8a62-432d-962f-d0cff826775e}/QR ");
}
}
}
Note the red text in the code above. This is the productcode of the installation and deployment project of the program you want to package. Where can I find this productcode? Remember, there are two systems, one is the system you want to package and the other is the console program. So, you need to understand this! Go to the project you want to package
See it. it's it! Copy it and place it in the console program to generate it. The file imported in the unit above is the file generated now !!