![]() |
|
How to make a Auto-Updater [VB.Net] - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: How to make a Auto-Updater [VB.Net] (/Thread-How-to-make-a-Auto-Updater-VB-Net) Pages:
1
2
|
How to make a Auto-Updater [VB.Net] - Blue - 07-01-2013 This is not the best auto updater but it gets the job done 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.NetStep 3: Add This Code under form load Code: If getXMLValue(TextBox1.Text, "latestVersion") = "2.7.0.0" Then 'Change 2.7.0.0 to the assembly version of your app'
MsgBox("No Update Found", MsgBoxStyle.Information, "No Update")
Return
Else
If MessageBox.Show("Update found! Would you like to download?", "Update Found", MessageBoxButtons.YesNo) = DialogResult.Yes Then
Dim wc As New WebClient()
wc.DownloadFile("http://yoursitehere.com/nameofapp.exe", "Name of App" )
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://www.yoursitehere.com/version.xml")
xmlr.Read()
xmlr.ReadToFollowing(setting)
Dim value As String = xmlr.ReadString()
xmlr.Close()
Return value
End FunctionStep 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>Step 5: Upload the version.xml file to x10hosting Your DONE! MUST READ! Spoiler: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 Credits go to original creators RE: How to make a Auto-Updater [VB.Net] - іиνιѕιв†ε - 07-04-2013 Thanks for sharing with us. This is really helpful for beginners. RE: How to make a Auto-Updater [VB.Net] - Blue - 07-04-2013 Yeah it is, Should help with a lot of programs and for owners who don't want to have to keep updating there thread. :hehe!: RE: How to make a Auto-Updater [VB.Net] - #Tiger - 07-04-2013 This is a different method to what i usually know, nice work. RE: How to make a Auto-Updater [VB.Net] - Shebang - 07-04-2013 Nice share for those who are new to coding. RE: How to make a Auto-Updater [VB.Net] - Hexology - 07-07-2013 Another way of doing this is using pastebin RAW text url for the dirrect download, so you can change it at any time, and then have another pastebin RAW text url for the Version info, Just have it read the string on the raw text page. RE: How to make a Auto-Updater [VB.Net] - BreShiE - 07-07-2013 This is a really fussy way to do this, it could be done so much simpler with just a .txt file. Code: Dim test As New WebClient() 'Declaring the variable TEST as a new WebClient
Dim ver As String = test.DownloadString("http://yoursite.com/programversion.txt") 'Declaring the variable VER [version] and assigning it to the text on that webpage
If ver > "1" then 'Asking if the webpage data [ver] is greater than to 1
Try
Process.start("http://yoursite.com/program.zip") 'If the site data does read as 1.1 then this page will open
Catch 'This will grab any error and tell the program to do the following code
End Sub 'Stops the current sub and allows the program to continue
End Try
End IfSorry about the shitty coding, my shift keys are currently broke so I can't code all that well. Yeah, this is a simpler way to do what you've shown. Although yours may work better with the DownloadFile, but wouldn't that be silent? Some people may class that as dodgy. EDIT: Cleaned up the code and added in some error handling, comments and indentation RE: How to make a Auto-Updater [VB.Net] - Helroos - 07-08-2013 Yea, you may also use webclient to download the file... RE: How to make a Auto-Updater [VB.Net] - Platinum - 07-08-2013 Cheap and easy way but it indeed does the job! Well done!! RE: How to make a Auto-Updater [VB.Net] - Wet - 07-15-2013 Awesome share, Blue! I'd say Blue-Quality, which is a synonym of being HQ. |