Deploying a C# application in VS2005
Deploying a C# application
Deployment is the process of distributing a completed application or component to be installed on other computers. . For console applications or Windows Forms-based smart client applications, there are two deployment options to choose from: ClickOnce and Windows Installer.
ClickOnce Deployment
ClickOnce Deployment (a feature of Visual Studio 2000 and NET Framework 2.0) allows you to publish Windows applications to a Web server or network file share to simplify Install. In most cases, it is recommended to use the ClickOnce option for deployment because it enables Windows-based applications to update themselves, minimizing user interaction required during installation and runtime.
Windows Installer
Windows Installer deployment allows you to create installation packages for distribution to users; users run the installation file and follow a wizard step by step to install the application. This is done by adding the installation project to the solution; once built, it creates an installation file that is distributed to users; users run this installation file and follow the wizard step by step to install the application.
Two clickonce technology in VS2005
1) After designing the winform program, you can choose to publish the program to the following storage locations: file system, local Web server, FTP Site, remote Web site.
2) After the application is deployed to the corresponding location, the user can browse a file called publish.htm through the browser, click the download link, and download the application to the local machine for installation. This publish.htm is an entry file for deploying applications.
3) After the user installs the program, a shortcut will be automatically generated on the desktop, and the program will be found in Add and Delete in the control panel. .
4) When the user starts the program, the system can first check whether there is a new program version on the server. If so, it will automatically connect to the server to see if there is a new version. If so, If there is a new version, it will automatically download the new version to the local machine and install it
Example of program deployment
First, open vs2005 and use C# to create a windows application. Then drag and drop a button into the form, and write the following code in the click event of the button:
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("hello world");
Close();
}
Run the above program, as shown in the figure below< /p>
Next, it's time to publish it. First, take a look at the Publish tab in VS2005. Right-click the project of this program and select the "properties" property menu, as shown in the picture below
The picture above is the property page of the project, which has many options. The top "publish location" option box allows you to specify the location where the project will be published. You can click the "..." button next to it to further browse and determine the publishing location, as shown below
Here, we can set the location where the project is to be published, such as the file system, local server, FTP site, remote site, etc. .
Next, in the "install mode and setting" option group, we can click the "Prerequisites..." button, where we can set additional library files or other files that need to be installed when running the application. The necessary documents are as shown in the figure below. What must be installed by default is .net framework 2.0. Also select windows installer 3.1
At the same time, we can select the update option in the "install mode and setting" tab, which is shown in the figure below
Among them, the default is to use Check for updated options when launching the application. You can also choose to automatically check whether there is a newer version when the application is connected to the Internet, or you can choose to automatically check whether there is a newer version as a background process after the application is started.
Select the "options" tab in the "installl mode and setting" tab, as shown below, and fill in some information about the application.
The settings have been completed and deployment can begin.
We use the "publish wizard" to publish. First select the location to be published, as shown in the figure below:
After clicking "NEXT", the following figure will appear. Here, you can choose whether your application is offline or can run offline and online at the same time. .
If publish is successful, the system will automatically open the IE browser and go to the publish page, as shown in the figure:
In this way, when the user starts the program, the system can first check the server Is there a new program version? If so, it will automatically connect to the server to check if there is a new version. If there is a new version, it will automatically download the new version to the local machine and install it.
< p>You can further test on other machines in the LAN (puter and click OK.Finally, some explanations of some options of publish
Publishing Location is the input program to be published. The address can be a network folder, HTTP, FTP, etc.
Prerequisites are the necessary prerequisites for the selected program installation, such as: fantasywork2.0, SQL2005, install3.1....
Updates is a setting for checking for updates to the program.
Whether to check for updates when the program starts, after the program runs, or once a week, you can set the number of days, etc.
Options are generally settings