By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,838 Members | 1,626 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,838 IT Pros & Developers. It's quick & easy.

Update EXE File

P: n/a
I want to have my application (VB.NET) check a table on an SQL server to see
if there is a newer version released and, if so, download and install the
new version. I know how to setup the database table but I am looking for
ideas on how to handle the update. Since the application is running, I can't
just replace that EXE. The only way I've thought of is to have a small front
end app that does the version check and download if needed? I'm not sure if
there are problems with doing a download/replace and then calling then
immediately executing that file.

I also am considering adding some way to save the replaced EXE so the user
could do a roll-back.

Has anyone implemented something like this? Any suggestions on the best way
to do it?

Wayne
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I haven't done it, but it seems like the easiest way would be to:

1. Call the update as a separate .exe from the main.exe
2. Shut down the main.exe
3. Update the main and any dll files
4. Restart the main.exe
5. Shut down the update.exe

If the update.exe needs updated, simply have it checked first and replaced
from the main.exe.

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
I want to have my application (VB.NET) check a table on an SQL server to
see
if there is a newer version released and, if so, download and install the
new version. I know how to setup the database table but I am looking for
ideas on how to handle the update. Since the application is running, I
can't
just replace that EXE. The only way I've thought of is to have a small
front
end app that does the version check and download if needed? I'm not sure
if
there are problems with doing a download/replace and then calling then
immediately executing that file.

I also am considering adding some way to save the replaced EXE so the user
could do a roll-back.

Has anyone implemented something like this? Any suggestions on the best
way
to do it?

Wayne

Nov 21 '05 #2

P: n/a
I've done this by creating a new .msi installation file for the upgrade.

What I do is have a bit of code that runs as the the application starts that
checks the version no - I do this in a similar way to that way you do it.

If an update is required, then I copy the msi file to the local PC.

At this stage I warn the user that an upgrade is required and ask then to
click ok to continue.

I then "run" the msi using the following code:

MsgBox("New DMS Update to Install, close all DMS Windows and click ok to
install", MsgBoxStyle.OKOnly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInfo

With prinfo

..FileName = "c:\dms\dms.msi"

..UseShellExecute = True

End With

pr.Start(prinfo)

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProcessesByName(Process.GetCurrentProce ss.ProcessName)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
I want to have my application (VB.NET) check a table on an SQL server to
see
if there is a newer version released and, if so, download and install the
new version. I know how to setup the database table but I am looking for
ideas on how to handle the update. Since the application is running, I
can't
just replace that EXE. The only way I've thought of is to have a small
front
end app that does the version check and download if needed? I'm not sure
if
there are problems with doing a download/replace and then calling then
immediately executing that file.

I also am considering adding some way to save the replaced EXE so the user
could do a roll-back.

Has anyone implemented something like this? Any suggestions on the best
way
to do it?

Wayne

Nov 21 '05 #3

P: n/a
Thanks Simon;

That sounds like a good approach. I'll give it a try.

In creating he msi for just the upgrade (I never thought of that) I am
guessing that you create a new VSNET solution and simply drop a copy of the
new exe in there and then build the distribution package?

Wayne

"Simon Verona" <ne**@aphroditeuk.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
I've done this by creating a new .msi installation file for the upgrade.

What I do is have a bit of code that runs as the the application starts that checks the version no - I do this in a similar way to that way you do it.

If an update is required, then I copy the msi file to the local PC.

At this stage I warn the user that an upgrade is required and ask then to
click ok to continue.

I then "run" the msi using the following code:

MsgBox("New DMS Update to Install, close all DMS Windows and click ok to
install", MsgBoxStyle.OKOnly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInfo

With prinfo

.FileName = "c:\dms\dms.msi"

.UseShellExecute = True

End With

pr.Start(prinfo)

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProcessesByName(Process.GetCurrentProce ss.ProcessName)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
I want to have my application (VB.NET) check a table on an SQL server to
see
if there is a newer version released and, if so, download and install the new version. I know how to setup the database table but I am looking for
ideas on how to handle the update. Since the application is running, I
can't
just replace that EXE. The only way I've thought of is to have a small
front
end app that does the version check and download if needed? I'm not sure if
there are problems with doing a download/replace and then calling then
immediately executing that file.

I also am considering adding some way to save the replaced EXE so the user could do a roll-back.

Has anyone implemented something like this? Any suggestions on the best
way
to do it?

Wayne


Nov 21 '05 #4

P: n/a
You create a Windows Installer Solution as part of your project..

This will take your main project as it's starting point and build an MSI
file for you to install with on client PC's.

Make sure you set the property "Detect NewerInstalledVersion" to True and
"RemovePreviousVersions" to true otherwise you will get errors about
"application already installed". Also, increment the version property of
the installer - this will prompt you if you want to update the product and
update codes (which you should). This should then allow you to update the
msi each time.

As far as checking that the correct version number is installed, you can
either manually include a file in with your installer with the version no in
or do as I do, and add the version number that you use in the installer
project to create a registry entry - to do this, right click the installer
project and "view registry". Create a path to the registry key that you
want and set this to [ProductVersion]

I actually read this registry key in from within the application so that I
know exactly what version I'm running (this is the version as manually typed
into the installer project rather than individual dll/executeble versions).

You may find all of this a little difficult to understand if you are not
familiar with creating installers in VS.Net (it's not all that intuitive and
the documentation relating to it is not brilliant!). Hopefully, I've given
you a few pointers to get you going.

regards
Simon
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Thanks Simon;

That sounds like a good approach. I'll give it a try.

In creating he msi for just the upgrade (I never thought of that) I am
guessing that you create a new VSNET solution and simply drop a copy of
the
new exe in there and then build the distribution package?

Wayne

"Simon Verona" <ne**@aphroditeuk.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
I've done this by creating a new .msi installation file for the upgrade.

What I do is have a bit of code that runs as the the application starts

that
checks the version no - I do this in a similar way to that way you do it.

If an update is required, then I copy the msi file to the local PC.

At this stage I warn the user that an upgrade is required and ask then to
click ok to continue.

I then "run" the msi using the following code:

MsgBox("New DMS Update to Install, close all DMS Windows and click ok to
install", MsgBoxStyle.OKOnly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInfo

With prinfo

.FileName = "c:\dms\dms.msi"

.UseShellExecute = True

End With

pr.Start(prinfo)

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProcessesByName(Process.GetCurrentProce ss.ProcessName)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
>I want to have my application (VB.NET) check a table on an SQL server to
>see
> if there is a newer version released and, if so, download and install the > new version. I know how to setup the database table but I am looking
> for
> ideas on how to handle the update. Since the application is running, I
> can't
> just replace that EXE. The only way I've thought of is to have a small
> front
> end app that does the version check and download if needed? I'm not sure > if
> there are problems with doing a download/replace and then calling then
> immediately executing that file.
>
> I also am considering adding some way to save the replaced EXE so the user > could do a roll-back.
>
> Has anyone implemented something like this? Any suggestions on the best
> way
> to do it?
>
> Wayne
>
>



Nov 21 '05 #5

P: n/a
Thanks for the addition information. Actually, I have built some install
packages using VSNET (as you say - not the greatest). I don't want the user
to have to do a full re-install as the msi is over 50MB (Crystal Reports and
several other components). I usually just replace the EXE file (about 1 MB).
I just try to adapt your process to do that.

Thanks again for all the help

Wayne

"Simon Verona" <ne**@aphroditeuk.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
You create a Windows Installer Solution as part of your project..

This will take your main project as it's starting point and build an MSI
file for you to install with on client PC's.

Make sure you set the property "Detect NewerInstalledVersion" to True and
"RemovePreviousVersions" to true otherwise you will get errors about
"application already installed". Also, increment the version property of
the installer - this will prompt you if you want to update the product and
update codes (which you should). This should then allow you to update the
msi each time.

As far as checking that the correct version number is installed, you can
either manually include a file in with your installer with the version no in or do as I do, and add the version number that you use in the installer
project to create a registry entry - to do this, right click the installer
project and "view registry". Create a path to the registry key that you
want and set this to [ProductVersion]

I actually read this registry key in from within the application so that I
know exactly what version I'm running (this is the version as manually typed into the installer project rather than individual dll/executeble versions).
You may find all of this a little difficult to understand if you are not
familiar with creating installers in VS.Net (it's not all that intuitive and the documentation relating to it is not brilliant!). Hopefully, I've given you a few pointers to get you going.

regards
Simon
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Thanks Simon;

That sounds like a good approach. I'll give it a try.

In creating he msi for just the upgrade (I never thought of that) I am
guessing that you create a new VSNET solution and simply drop a copy of
the
new exe in there and then build the distribution package?

Wayne

"Simon Verona" <ne**@aphroditeuk.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
I've done this by creating a new .msi installation file for the upgrade.
What I do is have a bit of code that runs as the the application starts

that
checks the version no - I do this in a similar way to that way you do it.
If an update is required, then I copy the msi file to the local PC.

At this stage I warn the user that an upgrade is required and ask then to click ok to continue.

I then "run" the msi using the following code:

MsgBox("New DMS Update to Install, close all DMS Windows and click ok to install", MsgBoxStyle.OKOnly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInfo

With prinfo

.FileName = "c:\dms\dms.msi"

.UseShellExecute = True

End With

pr.Start(prinfo)

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProcessesByName(Process.GetCurrentProce ss.ProcessName)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
>I want to have my application (VB.NET) check a table on an SQL server to >see
> if there is a newer version released and, if so, download and install

the
> new version. I know how to setup the database table but I am looking
> for
> ideas on how to handle the update. Since the application is running, I > can't
> just replace that EXE. The only way I've thought of is to have a small > front
> end app that does the version check and download if needed? I'm not

sure
> if
> there are problems with doing a download/replace and then calling then > immediately executing that file.
>
> I also am considering adding some way to save the replaced EXE so the

user
> could do a roll-back.
>
> Has anyone implemented something like this? Any suggestions on the best > way
> to do it?
>
> Wayne
>
>



Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.