Results 1 to 19 of 19

Thread: Program destruction, then downloads a new version.

  1. #1

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Post Program destruction, then downloads a new version.

    Hello, I need help with something. I need a way of updating that involves destroying the current .exe and then downloading the most recent version. I read about this and I think possibly a BAT would do what I need. I already have a check for updates code that gets read when form1 loads. the reason I need this is because I dont want to have to wait a long time for each update to download when if I do this it will be a 5-10 second proccess. i know its possible to do this as I have seen it done before. Here is my code so far:
    Code:
            Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://dl.dropbox.com/u/48466223/Updater Test/Update.txt")
    
    
            Dim response As System.Net.HttpWebResponse = request.GetResponse()
    
    
            Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
            Dim newestversion As String = sr.ReadToEnd()
            Dim currentversion As String = Application.ProductVersion
            If newestversion.Contains(currentversion) Then
    
    
    
    
            Else
    
    
                If MessageBox.Show("Do you want to Update?", "There is a new version.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
                    System.Diagnostics.Process.Start("https://dl.dropbox.com/u/48466223/Updater Test/Advanced Updater.exe")
                End If
            End If
            Label1.Text = System.AppDomain.CurrentDomain.BaseDirectory
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Program destruction, then downloads a new version.

    You could just use ClickOnce deployment, which has automatic updates built in.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by jmcilhinney View Post
    You could just use ClickOnce deployment, which has automatic updates built in.
    Hi, if I use clickonce could I import it for my current project, or do I have to make a whole new project? If I could import it into my current project could you explain In detail how to do it? Thanks!

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Program destruction, then downloads a new version.

    You simply use the Publish feature built into VS and VB Express to create a ClickOnce installer. In theory, you don't have to make any changes to your application project at all. You can configure ClickOnce using the Publish page of the project properties and then simply select Publish from the Build menu thereafter. ClickOnce does have some limitations and caveats though, so you should definitely do a bit of reading on the subject at MSDN and elsewhere to make sure that it suits.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by jmcilhinney View Post
    You simply use the Publish feature built into VS and VB Express to create a ClickOnce installer. In theory, you don't have to make any changes to your application project at all. You can configure ClickOnce using the Publish page of the project properties and then simply select Publish from the Build menu thereafter. ClickOnce does have some limitations and caveats though, so you should definitely do a bit of reading on the subject at MSDN and elsewhere to make sure that it suits.
    I need a new way of doing this as this isnt EXACTLY what i was looking for, I know there is a solution that is PERFECT for me, but I have no idea on how to make it. I want something where when you open the program it automatically checks for updates and if there are any it ask if you want to update then it closes and a .BAT opens, deletes the .exe and downloads a new one in the exact location. FAST. EASY. SIMPLE. Do you have any clue how this could be done?

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Program destruction, then downloads a new version.

    As mentioned... ClickOnce... that's what it does... you publish it to a location (it can be local or to a web server, or a server, doesn't matter) ... the user clicks on the link, it downloads and installs... the next time they run the app, it checks to see if there is a new version, if so, it is downloaded, installed and then runs... what does it not do that you want it to do?

    The alternative is to use a bootstrap app that checks & downloads and installs updates for you, then starts up the app when it's done... which is what ClickOnce does.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Program destruction, then downloads a new version.

    Well, what you just described would have the same end result as using ClickOnce except that ClickOnce is easier. It will automatically check for updates at startup and optionally prompt the user to download the update if you want. It will then download the update and replace the old installation. Exactly what you want except no need for a batch file or any code at all. What exactly is it about ClickOnce that you think is not suited to your situation?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by jmcilhinney View Post
    Well, what you just described would have the same end result as using ClickOnce except that ClickOnce is easier. It will automatically check for updates at startup and optionally prompt the user to download the update if you want. It will then download the update and replace the old installation. Exactly what you want except no need for a batch file or any code at all. What exactly is it about ClickOnce that you think is not suited to your situation?
    Here is the thing, when i tried to use clickonce I couldnt figure out a Update path, can you explain to me exactly how to set it up correctly?

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Program destruction, then downloads a new version.

    What exactly do you mean by an update path? It sounds to me like you're trying to make this hard when it's very, very simple. Have you actually done any reading about ClickOnce, as I suggested in post #4?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by jmcilhinney View Post
    What exactly do you mean by an update path? It sounds to me like you're trying to make this hard when it's very, very simple. Have you actually done any reading about ClickOnce, as I suggested in post #4?
    I have done ALOT of reading about this, I just dont understand how to setup the update location, is the location on my computer or on a share site such as dropbox? (If it is on dropbox then that would be great). I have attached a screenshot of what I'm talking about. All i want to know is if it is on my computer or dropbox. Thanks!
    Name:  2012-11-25_141937.png
Views: 370
Size:  41.8 KB

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Program destruction, then downloads a new version.

    That is the location that the application should look for updates. If you click the ? on the title bar of that dialogue it will open the relevant documentation and, for that field, it says:
    Specify the location of the application updates. This must be an HTTP or UNC location.
    Basically that is a single server location, on your LAN, intranet or the internet, where you will place the updates and all clients will then retrieve them from that one location. While I've never tried it, presumably Dropbox would be suitable.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by jmcilhinney View Post
    That is the location that the application should look for updates. If you click the ? on the title bar of that dialogue it will open the relevant documentation and, for that field, it says:Basically that is a single server location, on your LAN, intranet or the internet, where you will place the updates and all clients will then retrieve them from that one location. While I've never tried it, presumably Dropbox would be suitable.
    Last question, If i use dropbox or something similar do you I point the path to the folder of which all of the needed application files are located? like say they are in mydrop\publicfile\APPNAME\ Would I just put that path or do i put where the .exe is located?

  13. #13
    Hyperactive Member
    Join Date
    Aug 2011
    Posts
    272

    Re: Program destruction, then downloads a new version.

    You only point it to the folder, not the EXE itself. The IDE will then create an installer and other necessary files for ClickOnce to work.

  14. #14

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by samuelk View Post
    You only point it to the folder, not the EXE itself. The IDE will then create an installer and other necessary files for ClickOnce to work.
    When I go to publish it shows this:
    Name:  2012-11-26_180422.png
Views: 289
Size:  12.2 KB
    Can you give me example paths for an update location and what you use to do the feature. Eg: Dropbox

  15. #15
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Program destruction, then downloads a new version.

    Also, to answer your original question.....Windows allows running EXEs to be renamed so if you are using your own auto update infrastructure, what you do is rename the EXE, copy in the new EXE, run it and exit the current instance, the new instance should check for the renamed older version and delete it.

    I wrote my own auto update components a few years back and this is how I achieved it.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  16. #16

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    I'm aware of that way of updating, but thanks for sharing your knowledge!

  17. #17
    Hyperactive Member
    Join Date
    Aug 2011
    Posts
    272

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by pancakesplatter View Post
    Can you give me example paths for an update location and what you use to do the feature. Eg: Dropbox
    Between \\localhost and \Users, try putting C$ (with C being the drive on which the path exists.

  18. #18
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Program destruction, then downloads a new version.

    It's still not a valid (proper) update URL... because that's where any client is going to look... which means each client WILL LOOK TO ITSELF for the update... you can't publish to your desktop and expect everyone else to be able to access it...

    Dropbox should work... IF you use the PUBLIC address for the dropbox... in one statement you're saying "I want to use X" ... but then in your next post, you're doing "L" ...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  19. #19

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Re: Program destruction, then downloads a new version.

    Quote Originally Posted by techgnome View Post
    It's still not a valid (proper) update URL... because that's where any client is going to look... which means each client WILL LOOK TO ITSELF for the update... you can't publish to your desktop and expect everyone else to be able to access it...

    Dropbox should work... IF you use the PUBLIC address for the dropbox... in one statement you're saying "I want to use X" ... but then in your next post, you're doing "L" ...

    -tg
    I checked, dropbox dosnt support links for just a folder, only links to things within the folders, so dropbox will not work, what do you recomment?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width