473,382 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Update EXE File

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
5 4992
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Fie Fie Niles | last post by:
I have IIS installed on XP Professional workstation machine. I have an ASP page that open connection to an Access database, then when trying to update the database, it gave me the error "cannot...
1
by: revolnip | last post by:
As attached is the code : <% Option Explicit dim lngTimer lngTimer = Timer %> <!--#include file="Connect.asp" --> <!--#include file="Settings.asp" --> <!--#include file="Common.asp" -->
2
by: joo | last post by:
Hi! I need to implement something similar to "Automatic Update" feature which we see in windows 2000. We need this support for our software, basically to provide the software update. How can I...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Paulb1us | last post by:
I want to update records from a csv file. I do this in a button click: //Create Adapters da = new OdbcDataAdapter("Select * FROM test.csv", conn); //Fill a data table da.Fill(dt);
4
by: Ian Davies | last post by:
Hello I have seen some tutorials to put a update a counter field in a record. I have the counter field in a table that also has a field for a path to file. I display the records in a table on...
6
by: Rudy | last post by:
Hello all! I'm working in vb/ado.net I want to to have a message box pop up based on a result of a update on a SQL table. How do I do that so it automaticly pops up after the update is...
2
by: Miro | last post by:
I will ask the question first then fumble thru trying to explain myself so i dont waste too much of your time. Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an index - i...
6
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.