In addition to planning the functional items in the software architecture design, it is important to configure the automatic upgrade component. However, the automatic upgrade component is not directly referenced, it needs to comply with certain rules deployment to complete the automatic upgrade. It gives it to its configuration manual.
Essential File List:
File Name Function Description AppStart.exe A program that is similar to an intermediary, which starts a real application. It is not directly launched to prevent the upgrade failure to prevent the main application upgrade. AppStart.configappstart.exe configuration file, specify the directory where the application you want to start, and the most important component to start the application AppUdater.dll, the main component of the automatic upgrade of the main component system.resources.dll resource file mscorlib.Resources. DLL core resource file UpdateVersion.xml server-side version upgrade configuration file
Automatic upgrade configuration:
Precautions:
1. AppStart.config and appstart.exe cannot be changed because of the cause of the automatic upgrade component AppUpdater code.
2. The server side is best to use Windows 2000 Server. Using Windows 2003 Server will not access the server directory resource due to network security policies, the upgrade failed.
3. The server side needs to configure the upgraded site to allow directory browsing.
4. The hierarchy of the file must be configured as follows:
The client executor directory structure is as follows
AppStart.exe (can not be renamed)
AppStart.config (can not be renamed)
ClientExe (this directory name can be customized, but must modify AppStart.config AppFolderName items)
TrysmartClient.exe (this is a custom primary application)
AppUpdater.dll (Automatic Upgrade Components)
The appstart.config content is as follows:
Config>
AppStart.config explanation:
Tell AppStart.exe to find the primary application directory name.
Tell AppStart.exe to find the primary application name.
Server-side directory structure (this directory needs to be set to allow directory browsing):
Updateversion.xml (must, no name)
Ver (can be customized, but must modify the applicationURL item content of updateversion.xml)
TrysmartClient.exe (new version of the primary application)
Mscorlib.Resources.dll (resource file)
System.Resources.dll (resource file)
The UpdateVersion.xml content is as follows:
6.0.0.0 availableversion>
VersionConfig>
Updateversion.xml Explanation:
6.0.0.0 AvailableVersion>
Tell the client currently available version, the client AppuPdater component compares the local owner application version number and the version number of the configuration, if the download update is downloaded more than the local version number.
Tell the client Which URL is downloaded to update
According to the above directory structure and configuration file content, the key attribute configuration of the AppuPDater component should be as follows:
AutoFileLoad: TruechangeDeeServermanifestcheckUpdateurlhttp: //yourserverdomainname/smartserver/UpdateVersion.xml
AppUpdater component key attribute configuration explanation:
AutoFileLoad = true // Allow automatic file loading
ChangeDetectionMode: ServerManifestCheck // Detection mode: Detect according to the configuration file, that is, the file specified by the UpdateURL property.
UpdateURL: Specifies the automatic upgrade component detection server-side upgrade configuration file unified resource positioning position and file name. (That is, the URL)
The above configuration is passed under the .NET Framework 1.1 and Windows 2000.
AppUpdater automatic upgrade component download address: http://c2c.6688.com/Updatedown/appupdater.rar
Now let's use it in an instance.
Step 1: Establish an application to update
In this step we will establish an app to demonstrate how to implement automatic updates.
1. Generate a new Windows application project using vs.net, named "SampleApp".
2. Give the form you choose interesting background color. We will use the background color to distinguish the version of the later updated.
3. Now let's add a subtle feature to this app, first add a button to your form. A compressed file contains an assembly with a simple Windows form. Add a reference to the Samples / SampleApp / SimpleForm assembly in the compressed file. Then add two lines of code in your button event handle:
SimpleForm.form
1 f = new SimpleForm.form1 ();
F.show ();
4. Convert your build sign to Release from Debug. This will allow us to avoid later when we generate a new version of an application while the original copy is running the generated PDB file lock problem.
Generate and test your app.
Step 2: Add .NET application update components
In this step we will add a .NET application update component to SampleApp.
1. On the component tab of the VS.Net toolbar, right click to select Custom Toolbar. Select '.NET Framework Component' Tags. Click "Browse" and select AppUpdater.dll under the AppUpdater project in the compressed file. Click OK.
2. An AppUpdater icon should now appear at the bottom of the component list of the toolbar. Drag and drop the AppUpDater component to the SampleApp form. An instance of a .NET application update component named AppUpdater1 appears at the bottom of the form. Step 3: Set the .NET application update component
In this step we will set the .NET application update component. Note that this example you simply change the first four properties, others, the default value is enough.
AppUpdater attribute - this is the core of the .NET Application application update, the following settings are required for this program:
Property Name Description AutoFileLoad The command download feature to be described later will now be set to true. ChangeDetectionMode This enumeration determines how to check for an update. In this example, we will use a server to explicitly check, so set this value to "ServermanifestCheck". Showdefaultui .NET Application Update Components have a series of user interfaces to notify users some events, for this example we will use the default user interface, so set this value to true. UpdateURL UpdateURL is the decision update to find updates. In this example, the URL: http://yourwebserver/sampleVersion.xml is used in this example. Use your web server name instead of "YourWebserver"
The Downloader property -AppUpdater component has two subcomponents. The first is called Downloader, which controls the download and installation of the component. Below is a description of this attribute, and for my example, the default attribute value can work well.
Property Name Description DownloadRetryatTemPTS During the download period If there is an error occurred (such as web server downtime) Downloader will try again later. This property controls the number of times the network request is retryed before the application update error before the application is thorough. SecondsbeteweEndownLoadRety retry the number of seconds waiting before the network request. UpdateRetryatTemPTS This property controls the number of times attempting to update. ValidateAssemblies This property controls the level of the download assembly that is valid. See the security section of this article for more information.
The POLLER attribute - the second subcomponent of theappupdater is Poller. Poller controls update check. Below is a description of this attribute. For our example, all the default attribute values work very well.
Attribute Name Description Autostart Boolean value, control whether POLLER should start polling or if it should wait until the planned explicit starts when the application starts. DownloadOndtection Boolean value, control POLLER Whether to start downloading updates when a new update is discovered, or if you must start explicitly downloading by calling the downloadudpate () method. The number of seconds waiting for the first execution update check after the initialpollinterval application starts. After the first update check, PollInterval controls the number of secondspaces that follow the interval between the updates, note: The default is checked for every 30 seconds.
After all of this, your property form should look like this:
The Samples / SampleApp / SampleApp_complete directory contains a version that the application is installed correctly.
Step 4: Generate and deploy the application V1 version at the client.
In this step we will generate an application V1 version and deploy it on the client.
In the SampleApp project, open the assemblyInfo.cs file. Modify the value of AssemblyVersion from "1.0"
1.0.0.0 "This will result in the value of" 1.0 when generating the assembly.
0.0 "Tag, which is typically specified as incremented value in place .1. Build an application.
2. Copy the Samples / SampleApp / SampleApp_clientsetUp directory from the compressed file to your local machine. Note that the sampleApp_clientsetup directory already contains AppStart.exe. AppStart.config has been set to point to
1.0.0.0 directory and starts SampleApp.exe.
Copy SampleApp_ClientSetup from SampleApp (AppUpdater.dll, SimpleForm.dll, and Sampleapp.exe) from SampleApp's Release Generation Directory.
1.0.0.0 under the directory.
At this time, a complete application version should be "installed" to the client, can be executed by run appstart.exe.
Step 5: Install the web server
In this step we will install the web server to use when polling the application update. The .NET application update component uses HTTP-DAV to download the application update so you need a web server that supports HTTP-DAV. HTTP-DAV is supported by IIS5.0 and updated operating systems on Windows 2000.
1. Copy the Samples / SampleApp_serverseTup directory from the compressed file to the wwwroot directory on your Web server.
2. For complete, copy SampleApp's V1 version to the web server
1.0.0.0 folder.
3. Enable IIS's "Directory Browse" for the SampleApp_serversetup directory on your web server.
Step 6: Automatically update the application
OK, now is time to take a new version of these hard work by automatically installing a new version.
1. If you are deployed on the Sampleapp version of the client, load it to make it run. Remember to use AppStart.exe.
2. Back to VS.NET and do some modifications that can be noted in the Sampleapp form (such as modifying background colors).
3. Modify the version information of AssemblyInfo.cs to
2.0.0.0.
4. Regeneration.
5. Go back to the web server and generate one and
1.0.0.0 The same directory is 2.0.0.0. Copy the new version of the application to the newly created 2.0.0.0 directory on the web server from the Release generated directory.
6. Open Updateversion.xml and modify the AvailableVersion for
2.0.0.0. Modify ApplicationURL to point to a new 2.0.0.0 path.
7. Save the modifications made to UpdateVersion.xml.
Once you have saved new UpdateVersion.xml, within 30 seconds, the SampleApp copy in the run will detect a new version of the available version. Sampleapp will download a new version, implement updates, and pop up the default user interface asking if the user wants to restart and start using the new version immediately. Click Yes to return to the dialog box. SampleApp will restart and run a new version. If you view the deployment of client SampleApp, you will notice that now in the original
1.0.0.0 has a directory of 2.0.0.0. 1.0.0.0 The directory will be emptied when the next update occurs.
If you don't make the .NET application update device for some reason. Determine the following points before you go deep into debugging, what you encounter is likely to be one of the following:
• Do you open the IIS directory to open? If not, the update will not download to install any files.
• Are you correctly deploying everything and set up the URL correctly?
• If your application is installed in the Program Files directory, make sure you are the super administrator or super user of the machine? If not, you will not have write permissions to update the application. • Are you generating AppUpdater objects in the primary user interface thread of the application? If not, the update will not be able to display the user interface and failed when the excitation event returns to the user interface.
• Whether to update success, but the application failed when using new updates to automatically restart? The .NET application update component is trying to restart the application by calling the Application.exit method. However, this method does not guarantee an application. If you generate and leave a separate thread, this method cannot be turned off. Ensure that all thread terminated solutions are by calling Application.onexit events, or hooks the .NET application update event and processes the shutdown.