Click here to Skip to main content
15,166,972 members
Articles / Programming Languages / XML
Posted 24 Sep 2019

Tagged as


6 bookmarked

Update Checker

Rate me:
Please Sign up or sign in to vote.
3.12/5 (10 votes)
25 Sep 2019CPOL
Update Checker


I was looking for a simple solution of a common problem: you have created an update of your application.

After you uploaded it to the server, you want that all the "old" applications (clients) get a message about this new version by checking for this automatically.


My solution is very simple, the .NET DLL is small.

This XML file manages the updates (new Version 9.1.5 at

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

The main function Check4Update() reads the XML file and parses it:

XmlDocument oDom = new XmlDocument();

string str = oDom.SelectSingleNode("//currentVersion/major").InnerText;
Int32.TryParse(str, out _nMajor);

str = oDom.SelectSingleNode("//currentVersion/minor").InnerText;
Int32.TryParse(str, out _nMinor);

str = oDom.SelectSingleNode("//currentVersion/build").InnerText;
Int32.TryParse(str, out _nBuild); 

_sNewVersionPath = oDom.SelectSingleNode("//path").InnerText;

Using the Code

This solution is a .NET library (DLL) and can be used in every C# project by adding it as reference:

Then you only need to create an instance of it:

axcsCheck4Update.axMain oCheckClient = new axcsCheck4Update.axMain(txtXml.Text);

int nMajor = oCheckClient.GetVersion(axcsCheck4Update.enVerion.EMajor);
int nMinor = oCheckClient.GetVersion(axcsCheck4Update.enVerion.EMinor);
int nBuild = oCheckClient.GetVersion(axcsCheck4Update.enVerion.EBuild);

string strPath = oCheckClient.GetNewVersionPath();

After getting the current version's number, you can compare it to your version's number:

// Get my own version's numbers
Assembly assembly = Assembly.GetExecutingAssembly();
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);

int nAppMajor = fileVersionInfo.FileMajorPart;
int nAppMinor = fileVersionInfo.FileMinorPart;
int nAppBuild = fileVersionInfo.FileBuildPart;

And, if they are different, you can point users to this new version like this:


  • Version 1.0.0 released


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Leo Chapiro
Software Developer
Germany Germany

I'm a software developer living in Germany with my family (wife & 2 sons).
My hobbies: sport, traveling, books (former reading, now hearing).
Welcome to my homepage:

Comments and Discussions

QuestionNo result from "new axcsCheck4Update.axMain" Pin
Hanibani423-Jul-21 7:34
MemberHanibani423-Jul-21 7:34 
AnswerRe: No result from "new axcsCheck4Update.axMain" Pin
Leo Chapiro16-Sep-21 0:06
professionalLeo Chapiro16-Sep-21 0:06 
Questionlink is broken, and ... Pin
BillWoodruff29-Sep-19 23:08
mveBillWoodruff29-Sep-19 23:08 
AnswerRe: link is broken, and ... Pin
Leo Chapiro1-Oct-19 5:23
professionalLeo Chapiro1-Oct-19 5:23 
QuestionVery Handy Pin
  Forogar  26-Sep-19 4:22
professional  Forogar  26-Sep-19 4:22 
AnswerRe: Very Handy Pin
Leo Chapiro27-Sep-19 0:40
professionalLeo Chapiro27-Sep-19 0:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.