473,725 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5024
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******** ******@TK2MSFTN GP12.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.OKO nly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInf o

With prinfo

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

..UseShellExecu te = True

End With

pr.Start(prinfo )

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProc essesByName(Pro cess.GetCurrent Process.Process Name)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:uo******** ******@TK2MSFTN GP12.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**@aphrodite uk.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.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.OKO nly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInf o

With prinfo

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

.UseShellExecut e = True

End With

pr.Start(prinfo )

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProc essesByName(Pro cess.GetCurrent Process.Process Name)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:uo******** ******@TK2MSFTN GP12.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 NewerInstalledV ersion" to True and
"RemovePrevious Versions" to true otherwise you will get errors about
"applicatio n 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******** ********@TK2MSF TNGP15.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**@aphrodite uk.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.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.OKO nly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInf o

With prinfo

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

.UseShellExecut e = True

End With

pr.Start(prinfo )

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProc essesByName(Pro cess.GetCurrent Process.Process Name)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:uo******** ******@TK2MSFTN GP12.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**@aphrodite uk.com> wrote in message
news:OB******** ******@TK2MSFTN GP09.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 NewerInstalledV ersion" to True and
"RemovePrevious Versions" to true otherwise you will get errors about
"applicatio n 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******** ********@TK2MSF TNGP15.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**@aphrodite uk.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.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.OKO nly, "DMS Update")

Dim pr As New Process

pr = New Process

Dim prinfo As New ProcessStartInf o

With prinfo

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

.UseShellExecut e = True

End With

pr.Start(prinfo )

and then kill the running process using the following:

' Kill all processes

For Each pr In
Process.GetProc essesByName(Pro cess.GetCurrent Process.Process Name)

pr.Kill()

Next

This seems to work for me.

Regards

Simon

"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:uo******** ******@TK2MSFTN GP12.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
3961
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 update database or object is read-only". This is a workstation machine, not connected to any other computer, and I login to the PC using an administrator account. I already check the .MDB file is NOT read-only. But, I do not see the .LDB file....
1
2241
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
3068
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 exploit .Net technology to implement this? Any idea on this? Thanks.
16
17014
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 must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
3
2413
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
3011
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 a web page e.g. IndexNo ............Title................................ Link .................................... Count ......1.............MyFileName........www.mysite/files/MyFileName.doc........
6
1369
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 performed? Also, is there a way to put in a variable in the message box base on the results of the Update? TIA!!
2
3110
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 havnt tested the index yet ) so you can use an .UPDATE( dataTable ) on the data adapter. Otherwise you will get an exception error. Is this statement true? ---- Now me fumbling thru
6
7268
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 : evry day, i store the number of children in my classroom in my XML file. For exemple, on monday, my app ask me something like this : msgbox ("Are the 28 children here today ?",vbyesno)
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.