Update button new app release from share?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
lontru
Posts: 103
Last visit: Thu Mar 07, 2024 2:00 pm

Update button new app release from share?

Post by lontru »

Hi,

If you have build and app.exe and want to make a update button.

I put the new app version on this share \\server\release\app.exe

How do i make it update? Update click download the new app.exe from share and close the old app and start the new app up

how would you manage to do that?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Update button new app release from share?

Post by jvierra »

A running app cannot update itself. If you search carefully, you can find many examples of ways to detect an available update and apply the update from an MSI or from another app that is responsible for the update.

There are many ways to do this. It is not possible to advise you as to how to do this from the sketchy information you have provided. If you search and review the many methods, you will likely find one that matches your requirements.
xanders33
Posts: 1
Last visit: Tue Jul 18, 2023 10:03 am

Re: Update button new app release from share?

Post by xanders33 »

Thanks for the useful updating. I will sue that info during my research
User avatar
lontru
Posts: 103
Last visit: Thu Mar 07, 2024 2:00 pm

Re: Update button new app release from share?

Post by lontru »

so we need two app?

the program.
the updater.
Program trigger the updater who run the update files process? and then start the new program up again?
User avatar
owinsloe
Posts: 161
Last visit: Tue Mar 26, 2024 8:14 pm
Been upvoted: 1 time

Re: Update button new app release from share?

Post by owinsloe »

I perform auto-updates in my ui apps. I look inside a 'store' fileshare and compare the (Get-ChildItem "$MyScript").versioninfo.fileversion. If the store one is later..
1. rename (get-process -id $pid).path with an '.old' file extension (you can rename but not remove as it's inuse)
2. copy in the new version
3. close the running version and run up the new copy via
$st = new-object System.Diagnostics.ProcessStartInfo
$st.FileName = "$MyScript"
$st.Arguments = ""
$st.CreateNoWindow = $false
$st.WindowStyle = ProcessWindowStyle.Maximized
$np = [System.Diagnostics.Process]::Start($St)
The fact that the $MainForm.Close() precedes this and it still manages to hit the [System.Diagnostics.Process]::Start($St) is probably a matter of lucky timing, but it has always worked.
This topic is 1 year and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked