VB.Net Program should auto update -
i have program written in vb.net
, program supposed auto update. found how download new file , unzip it, problem cannot overwrite file long in execution. how done normally? thought "updater" on separate exe have same problem, couldn't update updater when make changes...
simply close old program.
keep separate updater program, when want update old program, updater close old program, download new version of app. example,
updater program,
private sub form1_load(sender object, e eventargs) handles me.load while true dim client new net.webclient dim newversion string = client.downloadstring("http://www.mywebsite.com/updates/latestversion.txt") if newversion <> io.file.readalltext("your programs file location") each p process in process.getprocesses if p.processname = "your program's process name" 'if don't know program's process name is, run program, run windows task manager, select 'processes' tab, scroll down untill find 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 want download new program (file location)") client.dispose() end if threading.thread.sleep(300000) 'freeze thread 5 mins... loop end sub
Comments
Post a Comment