What's new

{Tut} How to Make An Auto Updater

  • Thread starter Mets08123
  • Start date
  • Views 2,075
M

Mets08123

Enthusiast
Messages
153
Reaction score
22
Points
70
Sin$
0
This is not the best auto updater but it gets the job done :biggrin:

Step 1:
Just Add A Text Box Anywhere

Step 2:
Double Click the Form and add this code about Public Class (name of form)
Code:
Imports System.IO
Imports System.Xml
Imports System.Net

Step 3:
Add This Code under form load
Code:
If getXMLValue(TextBox1.Text, "latestVersion") = "1.0.0.0" Then 'where the 1.0.0.0 you have to change to YOUR version number'
Me.Close()
Return
Else
If MessageBox.Show("Update found! Would you like to download?", "Update Found", MessageBoxButtons.YesNo) = DialogResult.Yes Then
Process.Start("YourURLHere.com/app.exe", "yourappname.exe")
End If
End If
Return
End Sub
Private Function getXMLValue(ByVal update As String, ByVal setting As String) As String
Dim xmlr As XmlReader = XmlReader.Create("http://yoururlhere.com/version.xml")
xmlr.Read()
xmlr.ReadToFollowing(setting)

Dim value As String = xmlr.ReadString()
xmlr.Close()

Return value
End Function
Delete the extra End Sub if you get an error
Step 4:
Go to x10hosting.com and sign up for a hosting account.
Then, login into cPanel and go to File Manager.
Then, click upload and upload the NEWEST .exe of your app.

Step 5 (Making the XML File):
Open a new notepad file and add this code to it:
Code:
  <?xml version="1.0" encoding="UTF-8"?>
<checkForUpdate>
<latestVersion>1.0.0.0</latestVersion>
</checkForUpdate>

The version number doesn't matter. Now go to file>>>>save as... and make sure you have all files selected and name it version.xml

Step 5:
Upload the version.xml file to x10hosting

Your DONE!

MUST READ!​
Now in visual basics go to your apps properties>>>Assembly Information>> and change Assembly Version and File Version to a NEW version. So if your old one was version 2.6.0.0 you MUST CHANGE THIS TO 2.7.0.0 and so on FOR THE AUTO UPDATER TO WORK!

Now each time you want to update your app you MUST change the assembly information to the LATEST version. For example the assembly I used the version number was 2.7.0.0 so that was the latest version. EVERYTIME you want to release a new version you MUST change the version number.

Now when you want to make an update you have to change the .xml file to the NEWEST version number. Do this by going into cPanel>>>File Manager>>right click version.xml>>>code edit>>> then just change the to the NEWEST version of your app!
Also, you must also upload the NEWEST version of your app.exe


Any questions or comments just post :biggrin:

Source: Mets08123's Auto Updater.zip
 
UGG Ultimate

UGG Ultimate

Enthusiast
Messages
159
Reaction score
12
Points
70
Sin$
0
This is a great tutorial, its nice to see people writing tutorials like this.
 
kiwimoosical

kiwimoosical

Getting There
Messages
1,123
Reaction score
474
Points
205
Sin$
7
This is not the best auto updater but it gets the job done :biggrin:

Step 1:
Just Add A Text Box Anywhere

Step 2:
Double Click the Form and add this code about Public Class (name of form)
Code:
Imports System.IO
Imports System.Xml
Imports System.Net

Step 3:
Add This Code under form load
Code:
If getXMLValue(TextBox1.Text, "latestVersion") = "1.0.0.0" Then 'where the 1.0.0.0 you have to change to YOUR version number'
Me.Close()
Return
Else
If MessageBox.Show("Update found! Would you like to download?", "Update Found", MessageBoxButtons.YesNo) = DialogResult.Yes Then
Process.Start("YourURLHere.com/app.exe", "yourappname.exe")
End If
End If
Return
End Sub
Private Function getXMLValue(ByVal update As String, ByVal setting As String) As String
Dim xmlr As XmlReader = XmlReader.Create("http://yoururlhere.com/version.xml")
xmlr.Read()
xmlr.ReadToFollowing(setting)

Dim value As String = xmlr.ReadString()
xmlr.Close()

Return value
End Function
Delete the extra End Sub if you get an error
Step 4:
Go to x10hosting.com and sign up for a hosting account.
Then, login into cPanel and go to File Manager.
Then, click upload and upload the NEWEST .exe of your app.

Step 5 (Making the XML File):
Open a new notepad file and add this code to it:
Code:
  <?xml version="1.0" encoding="UTF-8"?>
<checkForUpdate>
<latestVersion>1.0.0.0</latestVersion>
</checkForUpdate>

The version number doesn't matter. Now go to file>>>>save as... and make sure you have all files selected and name it version.xml

Step 5:
Upload the version.xml file to x10hosting

Your DONE!

MUST READ!​
Now in visual basics go to your apps properties>>>Assembly Information>> and change Assembly Version and File Version to a NEW version. So if your old one was version 2.6.0.0 you MUST CHANGE THIS TO 2.7.0.0 and so on FOR THE AUTO UPDATER TO WORK!

Now each time you want to update your app you MUST change the assembly information to the LATEST version. For example the assembly I used the version number was 2.7.0.0 so that was the latest version. EVERYTIME you want to release a new version you MUST change the version number.

Now when you want to make an update you have to change the .xml file to the NEWEST version number. Do this by going into cPanel>>>File Manager>>right click version.xml>>>code edit>>> then just change the to the NEWEST version of your app!
Also, you must also upload the NEWEST version of your app.exe


Any questions or comments just post :biggrin:

Source: Mets08123's Auto Updater.zip
Or you could do:
Code:
If(new WebClient().DownloadString("http://www.sitename.com/updater.php") != "") Then
Process.Start(new WebClient.DownloadString("http://www.sitename.com/updater.php"), "yourappname.exe")
End if
 
trippinz

trippinz

Enthusiast
Programmer Grammar Nazi Frame In Gold
Messages
839
Reaction score
200
Points
175
Sin$
0
Check my other thread for a more advanced auto updater without the use of an xml file and with the ability to redirect to the new link.
 
Top Bottom
Login
Register