VB.Net Program should auto update

后端 未结 5 1469
忘了有多久
忘了有多久 2020-12-17 08:08

I have a program written in VB.Net and this program is supposed to auto update. I already found how to download the new file and unzip it, problem is I cannot o

相关标签:
5条回答
  • 2020-12-17 08:29

    simple solution, just divide the exe file source code into multiple DLL file(like divide in terms of modules) and have the main exe to execute the dll code like

    sub MDImainEXE_load()
    DLL.function like that
    end sub

    and you can use the same method for update exe send new main exe with configuration and DLL,configuration file will contain DLL names to update,if update exe has to update then name that DLL as argument to use because update exe will not contain code just use function from DLL file name from configuration file arguments.

    sub updateEXE_load()
    DLL.function like that
    end sub

    if confused then ask what confused.

    0 讨论(0)
  • 2020-12-17 08:35

    Old question, but what I do is, when I am within my main program, I copy rename the current updater, and then call out to the renamed updater like so:

    (note, code has been simplified for explanation and illustration)

    FileCopy("MyUpdater.exe", "~MyUpdater.exe") ' rename the updater
    Shell("~MyUpdater.exe") ' start the updater
    END ' close the current program
    

    Then when your updater does it's job, it will update MyUpdater.exe as well as everything else.

    0 讨论(0)
  • 2020-12-17 08:44

    Maybe something like Create A Dump File for a Running Process

    You see it here

    But it depends on your VB version....

    0 讨论(0)
  • 2020-12-17 08:49

    Simply close the old program.

    Keep the separate updater program, then when you want to update your old program, get the updater to close the old program, then download the new version of your app. For example,

    Updater program,

     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Do While True
            Dim client As New Net.WebClient
            Dim newVersion As String = client.DownloadString("http://www.myWebsite.com/updates/latestVersion.txt")
            If newVersion <> IO.File.ReadAllText("Your programs file location") Then
                For Each p As Process In Process.GetProcesses
                    If p.ProcessName = "your program's process name" Then 'If you don't know what your program's process name is, simply run your program, run windows task manager, select 'processes' tab, scroll down untill you find your programs name.
                        p.Kill()
                    End If
                Next
                IO.File.Delete("old program file location")
                client.DownloadFile("http://www.myWebsite.com/updates/12.05.2013.exe", "where ever you want to download your new program to (file location)")
                client.Dispose()
            End If
            Threading.Thread.Sleep(300000) 'freeze thread for 5 mins...
        Loop
    End Sub
    
    0 讨论(0)
  • 2020-12-17 08:51

    Why not just create a ClickOnce deployment, and host it somewhere?

    0 讨论(0)
提交回复
热议问题