Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I write C# programs / tools and want them to be updated automatically.
For example, whenever I click the update button in my form, the tool will look for a new version available on server.
How to achieve this in an easy way?

What I have tried:

I have found an open source updater, wyUpdate, written in C#.
I'm going to take a look at the source code, but may be some one has a simply idea how to achieve the same instead?
Posted
Updated 2-Oct-19 4:11am

1 solution

Take a look at this article: Update Checker.
I hope, this is exactly that what you need:

This XML file manages the updates:
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<myCoolApp>
    <currentVersion>
        <major>9</major>
        <minor>1</minor>
        <build>5</build>
    </currentVersion>
    <path>http://TestApp.exe</path>
</myCoolApp>

The main funtion Check4Update() reads the XML file and parse it:
C#
XmlDocument oDom = new XmlDocument();
oDom.Load(_sXmlConfig);

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;
 
Share this answer
 
Comments
SmokeHead 2-Oct-19 10:15am    
Thank you _duDE, looks good :)
I'll take a look!

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900