473,324 Members | 2,257 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,324 software developers and data experts.

Self updating exe


There's some articles about Smart Clients for .NET 2.0 but I am thinking
of a simple method to have a smart client I am writing update itself.

Question:

1) Say I create a web method that displays a version number

2) At start up, my client, wherever it is, tries to match the version number

3) If not, it wants to update itself.
So, my question is, is there away to get a windows application (exe)
which is already loaded, to copy a new version of itself across the
network, then shut down, and then load the new copy?

Can this be done with Reflection?
Nov 22 '05 #1
7 2121
John,

You have the right idea, but to make this work you need to have a
slight shift in thinking.

I've done a couple of Smart Client applications and have used a loader
application that executes prior to the actual application. This loader
calls a web service and presents a manifest (an XML document listing
all the assemblies and their related versions) to compare to a
server-side manifest which may have updated assembly versions ready for
download.

If new versions are found, the updater application copies the new
assemblies down to the application directory on the local machine. When
all updates are complete, the local manifest is updated and the updater
application launches the "real" application and shuts itself down.

Now, if you wanted to have an application check for updates while it's
running, you could use the same code that the updater uses while the
application is running. If new assemblies are detected on the server,
the application could notify the user and ask if they wanted to update
the application. If the user indicates "Yes," then the application
would launch the update application and shut itself down. It would have
the same basic effect of the user manually shutting the application
down and starting it back up. Then, once the updater application was
done downloading the new assemblies, it would launch the application
and kill itself again.

As I mentioned earlier, I've used this pattern on a couple of different
application and it works pretty well. I hope this answers your
question.

Thanks,
Denny Boynton

Nov 22 '05 #2

Denny,

Thanks a ton. That's exactly the insight I needed.

Denny Boynton wrote:
John,

You have the right idea, but to make this work you need to have a
slight shift in thinking.

I've done a couple of Smart Client applications and have used a loader
application that executes prior to the actual application. This loader
calls a web service and presents a manifest (an XML document listing
all the assemblies and their related versions) to compare to a
server-side manifest which may have updated assembly versions ready for
download.

If new versions are found, the updater application copies the new
assemblies down to the application directory on the local machine. When
all updates are complete, the local manifest is updated and the updater
application launches the "real" application and shuts itself down.

Now, if you wanted to have an application check for updates while it's
running, you could use the same code that the updater uses while the
application is running. If new assemblies are detected on the server,
the application could notify the user and ask if they wanted to update
the application. If the user indicates "Yes," then the application
would launch the update application and shut itself down. It would have
the same basic effect of the user manually shutting the application
down and starting it back up. Then, once the updater application was
done downloading the new assemblies, it would launch the application
and kill itself again.

As I mentioned earlier, I've used this pattern on a couple of different
application and it works pretty well. I hope this answers your
question.

Thanks,
Denny Boynton

Nov 22 '05 #3
Hi John, you might want to have a look at Microsoft's Updater Application
Block.

http://msdn.microsoft.com/library/de.../updaterv2.asp
--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
"John Bailo" <ja*****@texeme.com> wrote in message
news:KL********************@speakeasy.net...

There's some articles about Smart Clients for .NET 2.0 but I am thinking
of a simple method to have a smart client I am writing update itself.

Question:

1) Say I create a web method that displays a version number

2) At start up, my client, wherever it is, tries to match the version number
3) If not, it wants to update itself.
So, my question is, is there away to get a windows application (exe)
which is already loaded, to copy a new version of itself across the
network, then shut down, and then load the new copy?

Can this be done with Reflection?

Nov 22 '05 #4

This looks perfect except in the system requirements it says:

"System Requirements

The Updater Application Block requires the following software:

* Windows XP Professional"
It's not clear if that means it can only be deployed on XP Pro, or if
that's what it needs to compile it.

My shop has a mix of XP Pro, Home, w2k server, w2p pro, 98 so I would
need something that could update on all these platforms.

Tim Haughton wrote:
Hi John, you might want to have a look at Microsoft's Updater Application
Block.

http://msdn.microsoft.com/library/de.../updaterv2.asp


Nov 22 '05 #5

I was thinking of another method.

Couldn't I use Reflection.Emit ?

If I could send a byte stream of the new version, and have the old
version Emit the assembly, then shutdown the first copy and then save
itself to the name of the *.exe on disk?

This way I only need one exe not a loader and an application.

Denny Boynton wrote:
John,

You have the right idea, but to make this work you need to have a
slight shift in thinking.

I've done a couple of Smart Client applications and have used a loader
application that executes prior to the actual application. This loader
calls a web service and presents a manifest (an XML document listing
all the assemblies and their related versions) to compare to a
server-side manifest which may have updated assembly versions ready for
download.

If new versions are found, the updater application copies the new
assemblies down to the application directory on the local machine. When
all updates are complete, the local manifest is updated and the updater
application launches the "real" application and shuts itself down.

Now, if you wanted to have an application check for updates while it's
running, you could use the same code that the updater uses while the
application is running. If new assemblies are detected on the server,
the application could notify the user and ask if they wanted to update
the application. If the user indicates "Yes," then the application
would launch the update application and shut itself down. It would have
the same basic effect of the user manually shutting the application
down and starting it back up. Then, once the updater application was
done downloading the new assemblies, it would launch the application
and kill itself again.

As I mentioned earlier, I've used this pattern on a couple of different
application and it works pretty well. I hope this answers your
question.

Thanks,
Denny Boynton

Nov 22 '05 #6
John,

The Update Application block is an excellent way for looking at how
this process can work. I looked at it initially and what stopped me
from just using it was all the dependancies it has on the other
application blocks. In the end, it was faster and easier for me to use
the concepts exemplified in the Updater block and build my own
application specific to the environment to which the application would
be deployed.

Thanks,
Denny

Nov 22 '05 #7

It seems to necessitate a lot of additional layers and downloads to
accomplish something that can be done just as easily with your method.

Denny Boynton wrote:
John,

The Update Application block is an excellent way for looking at how
this process can work. I looked at it initially and what stopped me
from just using it was all the dependancies it has on the other
application blocks. In the end, it was faster and easier for me to use
the concepts exemplified in the Updater block and build my own
application specific to the environment to which the application would
be deployed.

Thanks,
Denny

Nov 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
2
by: Jaime Wyant | last post by:
*long post alert!* Can anyone give me some pointers on writing "self-updating" python programs? I have an application that is almost ready for beta testing. I want to be able to fix any bugs...
3
by: Nick | last post by:
Hi, I would like to make my application to automatically check on updates from a source and if any, downloads it and automatically updates itself with the new version. Now because the...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
10
by: Rada Chirkova | last post by:
Hi, at NC State University, my students and I are working on a project called "self-organizing databases," please see description below. I would like to use an open-source database system for...
2
by: mark s | last post by:
How can I make a simple, self-updating calendar in a form without using any controls except textboxes *or* toggle buttons? -- name: Mark S. email: huskie_009@hotmail.com *** Sent via...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
2
by: Paul | last post by:
I am moving an existing app written years ago to a new server. It uses Sigma Template 1.3 and Quickform 1.1.1 and PEAR.php,v 1.1.1.1 2004/02/16 The directory structure is like this: /site...
2
by: ohioguy | last post by:
We've developed a VS2005 C# solution that requires assemblies be installed in the GAC on the client machine. Here are the following goals: 1. Remotely install this application, registering the...
1
by: Tim Haughton | last post by:
What is the preferred method of implementing a self updating WPF app? Is it still the UAB? Cheers, Tim
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.