How to Create self-updating applications in .Net Compact Framework

In any application software, there will always be a need for updations or enhancements due to additional features that have to be incorporated into the exiting system on an ongoing basis.



Further, the existing identified bugs also need to be addressed with an upgradation in the running version. Hence, to make the software up to-date and to meet the changing trends, you need to keep on enhancing the existing application software at regular intervals.

As a layman or as a person not getting involved in the evolution of the application software, you may know when to update your application or how to fix the bug that has been reported lately or how to keep track of the version control. Hence there is need for certain self-updating applications and the need for effective control over the flow of updation process when a user is using a mobile device for application update.

There will be always two major parts in any of the self-updating application and they are:

· Updater applet
· Web service

These two components are responsible for directing the users as to where to get information and know the exact location of the self-updating update availability. The minimum requirement will be a web server that could provide the update facility for the devices concerned and be able to carry out the updation process based on the various identified devices that are accessing the web server.

Out of the various platforms available today for use in update server, the IIS and ASP.Net are very popular. ASP.Net is a superior tool used today for any web-based service and it is possible to maintain a database of all the available updates in a XML document format. XML based files are easy to load, edit and save and hence XML documents are extensively used in any web based services.

First and the foremost point in any web based updation process are the information on the update patch. There is always a possibility of different people accessing the web server for updates and the machines from which they access will also be different in their configuration and architecture. Hence, your web server should be capable of catering to the needs of all the users who access the server and all the relevant information should be carried in the format of a XML document that in turn could cater to the needs of various types of downloads.

We will see one of the common forms of XML document that can be used to disseminate information on various type of downloads:

<?xml version="1.0" encoding="utf-8" ?>
<updateinfo>
<downloadmodule plat="xxx" arch="xxx" name="appName" action="cab">
<version maj="2" min="0" bld="2363"/>
download/appName_xxx.xxx.CAB
</downloadmodule>
<downloadmodule plat="yyy" arch="yyy" name="appName"
action="cab">
<version maj="4" min="3" bld="3434"/>
download/appName_yyy.yyy.CAB
</downloadmodule>
</updateinfo>

In any XML document, the root element will contain the information on updates and the child element can be made as a download module that can be made use by different downloading platforms. The child element can also be made use for giving information on the compatible architecture of downloading CPU, the application name, version and type, and other relevant information such as major version, minor version, build number, etc.

The applet that has been incorporated into the updater application can check the mobile device and once a suitable update is identified, information will be sent to the mobile device prompting the user to choose the available options and download the required one. Depending upon the user’s response, the update will either be downloaded to the mobile device or disconnect the connected mobile device from the network.

XML storage format is the widely used format in any web based services, and when any project is created, the version will get set to 1.0 initially. A small configuration applet sample is given below:

<?xml version="1.0" encoding="utf-8" ?>
<updateinfo>
<checkassembly name="MyApp.EXE"/>
<remoteapp name="MyApp"/>
<service url="http://updates.mycompany.com/UpdateAgent/Agent.asmx"/>
</updateinfo>

Further, tags can also be used for many purposes and to quote few:

· For retrieving any version related information, checkassembly name will be used
· For deciding on the exact update required, remoteapp name will be used
· Service gives the URL of the web service to use with this application.

You will be able to read and retrieve any detail regarding the XML configuration details by simply loading the XML document.

XmlDocument confg = new XmlDocument(); confg.Load(confgDocumentPath);
The update service is implemented as a web service. The URL that the web
service proxy uses, is set dynamically as,
Agent agt = new Agent();
agt.Url = xmlConfg["updateinfo"]["service"].GetAttribute("url");

The most commonly used method to invoke update service is the GetUpdateInfo and once the call is routed and connection established successfully, the necessity for the update can be assessed from the available update information. On establishing the connection, the details about the CPU architecture will be passed on to the web server and a correct CAB file (Cabinet file) will be transferred to the device using the HttpWebRequest class. Finally on the availability of an appropriate update the file will be downloaded to the device and the user will be prompted for installing it.

_______________________________________________________________________

Add to My Yahoo!


FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

Visit .NET Programming Tutorial Homepage

______________________________________________________

Recommended Resource


| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.