Clickone: Release Windows Applications

Source: Internet
Author: User

Use clickone to publish a Windows ApplicationProgram 

 

Preface
This section describes how to use clickonce to publish a Windows application. Developers generally follow these steps to achieve the purpose of publishing.

This article only introduces the simplest use. More advanced usage is currently being studied. I hope this document can be improved as soon as possible.

For more details, refer to Microsoft online msdn. The above introduction is very detailed and you will have time to sort it out and add it to this document.

 

Clickonce Introduction
Clickonce deployment allows you to publish Windows-based applications to Web servers or share network files to simplify installation. Visual Studio fully supports the release and update of applications deployed through clickonce. Clickonce deployment can be used for projects created using Visual Basic, Visual C #, and Visual J #, but not for projects created using Visual C ++.

Benefits of using clickonce
Using clickonce to publish a Windows application allows you to easily update the application and perform B/S. When the application is updated, you do not have to reinstall the update. The program publisher only needs to put the new version on the server, and the program user can update the software when starting the software or exiting the software (for more details, refer to the graphic release process ).

Of course, to make the installation process more visible and add more operations during the installation process, you should create your own installation program.

Graphic release process
First, select the project to be released, right-click and select "properties", and then select the "publish" option page, as shown in:

To release software, first understand the following items:

    • Release location

That is, where the files generated by program publishing are stored. These paths can be URLs, shared folders, and absolute local paths.

 

    • Installation URL

That is, when the user needs to install the software, the access path will be downloaded here for installation. The path must be a URL. This path is generally the server's IIS Site path. For example, the program you published is stored in the local IIS site http: // localhost: 8000/anthortest /. However, the released program should be placed on the client's server. If the IIS Site of the client's server is in the LAN path http: // 192.168.1.174: 8012/setup. Enter this path for the installation URL.

When you need to install the software, you only need to access this path. After you click "Install", there will be a prompt about the installation process.

 

    • Update location

That is, the path that the customer accesses when the software starts or exits. When the software accesses this path, it checks whether a new version exists. If yes, it prompts whether to install the update.

This path should be the IIS Site on the client server. The files published by the program will be copied to the directory where the site is located (if this path is different from the publishing path ).

When the path is different from the release path, click "Update" to display the following interface, and enter the corresponding path.

    • Installation mode and settings

Generally, select "available for offline use ". Otherwise, you must connect to the machine where the "Update PATH" is located to use the software.

 

Clickonce advanced options
The following describes the options.

Application Files
This section lists the files that will be included (published) when a program is released.

Note: This function of VS is not perfect. If the program references the office component, it will put stdole. DLL, office. DLL and Microsoft. VBE. interOP. DLL is required as a system. When the client is installed, different versions may occur (because the installed office version is different, which generally does not affect the program usage, you should change the "release status" of these DLL to "include" so that no errors will occur.

 

Required
Select the components that will be automatically installed when the software is installed. Developers can choose based on the components used by the development. For example, if you use a crystal report, select the "Crystal Report viewer" component.

Note that, to make it easier for customers to install software, select "Download necessary system components from the same location as my application ". In this way, the components will be included in the same path of the installer. When the customer installs the software, if there are no necessary components for computing, the component will be downloaded from these paths for installation.

 

Update
Here is the program update option. Developers can select as needed.

 

Option

You can set some advanced options or enter some advanced information here. For example, select "release language.

The publishing path may be deployed on the local machine, but the server deployment is not necessarily on the local machine. For example, if you publish a file on a developer's machine, you need to copy the file to the customer's server for deployment, this requires that the "Release path" is different from the "installation path" and "Update PATH". At this time, it is best to cancel the selection of "verify files uploaded to the Web server, because the "installation path" and "Update PATH" may not exist, canceling this option will greatly speed up the release.

At the same time, you can also change the deployment website to “h.html ". This can also prevent malicious Website access by others in a certain degree of program.

 

Select a clickonce update policy
When designing a clickonce application, you need to determine the policy that the application will use to check for available updates. There are three basic policies available: checking for updates when the application starts, checking for updates after the application starts (running in the background thread), or providing a user interface for updates. In addition, you can determine the interval at which the application checks for updates and force the update to be executed.

 

Server deployment
Follow the "installation path" to copy the published file to the corresponding machine's corresponding IIS Site. For example, if the "installation path" is http: // 192.168.1.147/dorichtoursetup, copy the file to the virtual path "dorichtour" under the default website (port 80) on this machine ".

This is especially important. The official file of the virtual directory is publish.htm ". In this way, customers who need to install the program can smoothly enter the installation interface. The following figure shows several configurations of this "virtual path". For details, refer:

L set the release file to publish.htm.

 

L configure Directory Security

Set "Allow Anonymous Access" for identity authentication under "Directory Security"
 

Note: If the "Update PATH" is different from the "installation path", configure the "Update PATH" on the same machine. These two paths are generally the same, and different developers will negotiate with the deployment personnel.

 

Client deployment
After the server is deployed, the client who needs to install the program only needs to visit the site of the "installation path". The following interface is displayed, and a prompt is displayed when you click the "Install" button:

Note that the installation process is automatic. The path for storing the installed files is generally c: \ Documents and Settings \ Administrator \ Local Settings \ apps \ 2.0 \ v6v6qmr5.4dg \ qy7x63ph. the corresponding path under TLV, where "Administrator" is the installer system. If the above path does not exist, find the path C: \ Documents and Settings \ Administrator \ Local Settings \ apps \ 2.0 and then find the corresponding path. Of course, there is a way to find the path: In c: \ Documents ents and documents, you can find the corresponding file to know where the path is.

 

Generate release packages for different application customers (manual deployment)
When generating a release package for different customers, you can generate a new release package according to the preceding steps. However, the disadvantage is obvious: there may be many customers; after the software is completed, the development environment may not be fully saved, and the complete development environment is re-required according to the above steps; the applications used by different customers are the same, but the installation path is different.

Therefore, it is best to use existing release packages to generate release packages for different customers. The following describes how to use an existing release package to generate a release package for different users without generating an application.

Refer to "manually deploying the clicokonce application" in msdn ". However, users who are not familiar with clickonce publishing generally do not agree to use manual Publishing. Use the above steps to generate a release package and then follow the instructions below to generate different user release packages for different users.

 

Preparations
L determine the deployment type

If a deployment is automatically installed using cdns, The setup.exe file is included and cannot be modified. Therefore, you must generate a new release package for different users.

If you do not use CD for automatic installation, you can generate different release packages for different customers based on the existing release packages. Continue.

 

L process the setup file

If it is not in the form of CD automatic run installation. You can ignore the setup.exe file. You can delete it.

 

L process the publish.htm File

The installation of the public.htmfile is linked to the setup.exe file. Change to the "deployment list" file.

For example, set href = "setup.exe"

Change to href = "clickonceexample. Application"

At the same time, when you use vs2005ideto generate a clickoncedeployment package, the publish.htm file will be updated. In fact, this file can not be regenerated unless there is only one customer. You can modify the source file of publish.htm when adding the corresponding content to the publish.htm file. To keep the publish.html file unchanged, cancel the "automatically generate deployment webpage (g) after each release" option in "options.

 

Generate Application List
The Application List is generally located in the version file. The name format is: Full name .exe. manifest. This file stores the files that should be included in the application deployment.

If the files in the package are not released (all files in the folder of this version) for modification, you do not need to process the Application List.

If any file of the release package is modified, for example, the content in the application configuration file is modified. You need to generate a new application list. Then, use mageui.exe (this tool comes with. Net sdk2.0 and saved in the tool folder under the project "clickonceexample") to open the corresponding application list and then "save ". A signature is required for saving. developers can select the corresponding certificate file. Generally, the certificate file generated when the application is released for the first time (when the clickonce application is published using vs2005ide, A certificate file is automatically generated ).

At the same time, it should be noted that the files in the release package use DeLoy as the file suffix by default, mainly to prevent the user from modifying and the Application List must be regenerated. Sometimes, when generating release packages for different customers, you need to modify the corresponding files, so you can cancel the "use DeLoy file extension" option in "options.

 

Generate deployment list
The key to generating different release packages for different customers is the deployment list, which determines where to install the packages. This file must be regenerated.

Use mageui.exe to open the corresponding deployment list and modify the corresponding options. You need to modify the options as follows: startlocation and application reference. Startloation indicates the deployment list pointed to during installation. It should be the complete path of the site + The Name Of The deployment list, for example, http: // 192.168.1.75/clickonceexample. application; application reference indicates the Application List to which the object is directed. Select the Application List in the corresponding version folder. Save the settings. A signature is required for saving. You can use the same certificate file when signing the Application List. If the certificate expires, another test certificate can be generated.

Edit the deployment list as shown in. After the deployment list is edited, the original release package is the release package of the new customer. You can directly deploy the release package.

Notes
Solution Project Settings

Clieckonce mainly publishes Windows applications. When the solution has multiple Windows applications, the publishing process becomes complicated and troublesome. It usually fails (currently I have not tried to release a solution for multiple Windows applications ).

Therefore, the general solution only contains one windows application (usually a startup project), and other projects should be class library projects. In this way, the release process will be as simple and smooth as described above.

 

When an output file exists
For example, a project contains a Word document or an Excel document, and the document is output to a certain path. In general projects, you only need to select "Copy to output Project" in the Document Property Window and select "copy if new" or "always copy ". If you use clickonce to publish a Windows application, select "content" in the "generate operation" option ". In this way, the document can be published together at the time of release. Otherwise, the document cannot be published, leading to software errors during use.

Dll version Problems
You can find the corresponding DLL in "application file" () and change "release status" to "include", which may eliminate errors. Because this function of clickonce technology is not complete enough, some unnecessary dll will be considered as a required DLL.

Network Error prompt
This is generally divided into problems with real network devices. However, if you view the details, the error message "XX File Download error" appears ". Most of them are configuration errors. If the "configuration file" fails to be downloaded, most of them are IIS configuration problems. Make sure that the ASP. NET configuration version of IIS is 2.0. For example:
 

The value is out of the range.
When an application is installed or started, an error occurs and the error message "value out of range" is found in the log file ". At this time, it may be because some programs released using clickonce are not completely uninstalled. In this case, uninstall this application or all the Software deployed using clickonce, and then run c: \ Documents ents and Settings \ Administrator \ Local Settings \ apps \ 2.0 \ Program v6qmr5.4dg \ qy7x63ph. delete all the folders and files in the TLV path, and then reinstall them.

 

Certificate Expired
Sometimes publishing failure may be "Certificate Expired ". In this case, you can view whether the certificate has expired on the "signature" tab (for example) in the Properties window of the project. If the certificate expires, click "create test certificate" to create a new certificate.

 

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.