How to deploy the .NET WinForm program using installshield x expression
The title: Today is a day to publish tests for half a year, so write this article to show commemoration.
First, please refer to the version evolution of InstallShield X Express
Http://blog.joycode.com/hopeq/archive/2004/07/26/28421.aspx
Second, INSTALLSHIELD X Express for Visual Studio .NET 2003 provides internal support for .NET. All operations are completed in the VS IDE, and its effect is equivalent to the functionality of the independent IDE of INSTALLSHIELD X Express (hereinafter. Article uses independent IS IDE as an example
Third, you will learn about this article
(1) How to add your own project file
(2) How to add related components, such as MDAC
(3) How to customize the operation, and give an example of a commonly used registration operation.
(4) How to release DOTNETFRAMEWORK
Fourth, we start
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_1.jpg
This is the main interface of IS
1. Click Fileànew to create a new project, come out
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_2.jpg Figure 2 New Project
In terms of reason, we have to publish a C # program, this should be selected, after selecting this, actually choose a C # project in the back wizard, and automatically open with VS (no solve ), Good, the subject is back. Press the settings of Figure 2, select Express Project, Enter Engineen, Save Path, Pay At Project Language, the default is English, if you have Chinese information in your project (such as company name with Chinese), please choose Chinese. (simplified), remember, or garbled. Click OK
Figure 3 appeared
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_3.jpg Figure 3
Please note that there are more ProEJCT ASSISTANT, INSTALLTION Designer above the main form, and now the interface is the former, its operation is equivalent to the graphic operation, the operation process is below Figure 3, click Application Information,
Figure 4
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_4.jpg
Figure 4
This place is simple, write your company name, the name of the application, namely the name of the installer. There is also version number, as well as your company's home page, whether the user is automatically notified to have an update, below is the icon to which you want to display when you want to add, delete. These are not important, let's click, INSTALLATION Requirements, is the system requirements when the program is installed, and the operating system is selected, and the components are selected below because we need MDAC, so choose MDAC Version 2.7.
Click Installation Architecture, here is the default. Click Applicatin Files, here is where you add your own file, please see the picture below http://blog.9cbs.net/korny/87532/o_5.jpg Figure 5
On the left side of Figure 5, it is the path to the target computer (ie the installer's computer). Generally, we can change "My Product Name" and my company name directory, but it can be changed in the program files. It is also reasonable here, first company, in the company's product name.
Ok, now you can press the Add Files and Add Folders, let's add a file first, select the file to be published, will come out, you will find a prompt box, want you to find a dependency file, then you choose Yes to all, here If you contain other components, it will automatically contain components when you package it .NET file.
Similarly, the directory is also the same method.
Click Application Shortcuts, appear] http:/blog.9cbs.net/iMages/blog_9cbs_net/korny/87532/o_6.jpg Figure 6
If you want to create a shortcut on your desktop, first select the file, click Create Shortcut on Desktop.
Below is an extension multiple icons, that is, in the properties you can choose different icons.
Click Application Registry, the relevant registry operation, as shown in Figure 7
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_7.jpg Figure 7
Select Yes, now you can edit it with the registry, you can add some static items, of course, if you want to write the path to the user installed on the registry? Don't worry, introduce it in the back :)
Click Installation Interview, Figure 8
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_8.jpg
Figure 8
Specifically, I have already marked with the icon.
Click Build Installation, select Single Executable. That is, finally packaged into an execution file.
Telling such a step below is the most critical, go to the Installation Designer mode http://blog.9cbs.net/korny/87532/O_9.jpg Figure 9
If MDAC 2.7 is selected, if the target is not installed, the installer will install automatically.
Ok, now we can customize the operation, huh, you can freely
Click on the define setup required on the left side setup Requirements and Actions-àcustom actions-
All the mounting process here, you can want to insert which step can, we choose to operate after the file is copied to the other party's target computer, in the After File Transfer item, right-click New EXE,
Select File Exists On Target Computer in the Source Location on the right, then select the directory in File Location. The most important thing is below, how do we write the path selected by the user to the registration table? In File Name and Command, select the file name to add parameters, such as the program written in the registry, REG.EXE. So how do we fill in FileName and Command Line?
REG.EXE [InstallDir]
Ok, this can pass the installation path to Reg.exe, and it is important to organize this parameter in reg.exe.
Please see the code below
Static void main (string [] args)
{
// has been taken after the directory /
String path = string.empty;
FOREACH (String Arg in args) {
Path = arg;
}
PATH = path.trim ();
IF (path.length == 0) {
Return;
}
SoftInitRegister (path); // Start registration
}
Is there a problem with the code above? Oh, there is a problem. How to modify? Simple, put
Path = args; change to Path = Args ""
Oh, very simple, pay attention to it. Some registration methods, this is the registration method of my system, huh, hurt :)
Public Static Void SoftinitRegister (String InstallPath) {
String ApplicationExec = InstallPath "CEIM.exe"; // Primary application
String ApplicationExec_Acc E = 4 "CEIM.exe% 1"; // Main Application Accessory Execution
// Write software installation place
RegistryKey regkey = registry.currentuser;
RegistryKey Writekey = regKey.createSubkey (@ "software / ceim);
WriteKey.SetValue ("AppBasePath", InstallPath;
/ / Let CEIM are automatically loaded when Windows is turned on.
Regkey = registry.localmachine;
Writekey = regkey.createSubkey (@ "Software / Microsoft / Windows / CurrentVersion / Run");
WriteKey.SetValue ("CEIM", ApplicationExec);
// Write the right menu --- file association
Regkey = registry.classessroot;
Writekey = regkey.createSubkey (@ "* / shell / ceim / command");
WriteKey.SetValue ("", applicationexec_acce); // The first parameter corresponds to the "default" of the registry
// Write the right menu --- Directory Association
Writekey = regkey.createSubkey (@ "folder / shell / CEIM / COMMAND");
WriteKey.SetValue ("", applicationexec_acce); // The first parameter corresponds to the "default" of the registry
}
OK, we should also go to the last step, slow, you haven't mentioned how to publish DOTNETFRAMEWORK?
Just when you call the components of MDAC 2.7, don't there a lot of components let you choose? I can't find it? Oh, yes, there is really no, what should I do? look down
http://blog.9cbs.net/images/blog_9cbs_net/korny/87532/o_10.jpg Figure 10
I said that you will understand the path.
Prepare for release ---- àbuild your release ---- then set the settings as shown in Figure 10
OK, press the menu build-àbuild singleimage, very successful!
To be honest, this is my first time to write a tutorial (Ya said), today is also happy, the last time I thought, I have to write something, I haven't written it, this is made up, I still spend time, I have time, It's more than 3 hours. But you can share your own experience with you is the happiest.
Dengfeng
1/10/2005