Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello CP'ians,

i got a Question about how to update a program (selfwritten software).

On the forehand, the software is written by me and at first for internal purpose.
Therefore i thought about about a selfwritten software updater that would just replace the outdated .dll and .exe files. On the other side, this piece of work could be transferred to our friends in Japan.

Therefore i wanted to ask if im going the right way or if someone might have a better idea than me.

To describe you the situation:
The software is splitted into different parts and applications. That's why i have to implement a update logic that seperates each application. Currently i would have 3 different states.
State 1: Project-App is installed -> only update necessery stuff for that
State 2: Admin-App is installed -> only update necessary stuff for that
State 3: Both are installed -> update everything

My idea is to provide the new files on a build server, so that everyone has "access".

Currently i am thinking about an XML file that serves as config and stores what has been installed and knows the needed files + location. This could be initialized on installation. Then my Program checks if an update is available, if yes starts the updater which is copying the files and restarts the program.

Now i encouter several problems, i don't have an installer and since the one VS provided isn't there anymore i guess i have to write my own?

Another thing is, how could i cope with new added (modules) .dll/.exe/whatever files that are not listed in the xml?
-I thought that my program always checks if the xml changed, but that means i have to have an xml file on the server for every program and have to maintain it by hand.
So how would one cope with that?

Last but not least, when we ship the program, they can't maintain the stuff i can do for internal purpose.
So what should i go for? Is VS's patchthingy sufficient for that? Does it work if you would host the patches on a own server?

That's why i question, should i go for the integrated tools that VS provides, like creating patches and stuff and using "their installer" or does someone of you know a better idea, less MS attached and am i missing something?

Please feel free to ask if you need additional info
Regards and thanks
HobbyProggy
Posted
Comments
dan!sh 11-Jan-16 6:46am    
Assuming this is a client server based application, here is what I can think of. When the client application is installed, create a JSON file with all DLL names and versions. Keep latest DLL files which are needed by client on some location at server. When the client application runs, it should first send this JSON to server which can be matched with latest version. If the client is outdated, server should then push the latest DLL files to client installation directory. Of course, you will need a user name that does have access to push the files to all the client computers.
BillWoodruff 11-Jan-16 8:54am    
I think your comments here deserve to be posted as a solution, so you can get the +5 you earned !
dan!sh 11-Jan-16 22:14pm    
Done!
HobbyProggy 11-Jan-16 6:53am    
It will be client <-> server based as soon as i transfer my SQL into a Observer. That's actually not a bad idea, i didn't work with json yet but i guess that should be rather easy? But if understand correctly i have to write an installer and an updater right?
And additionally, what about new modules?
dan!sh 11-Jan-16 7:19am    
I just mentioned JSON since that will be lightweight compared to XML. It is plain text and you can use NewtonSoft provider to parse the data. It should not be an issue.

I don't think you will need an installer. If your initial install merely copies DLL files in to a specific folder, then you just need to replace the files. Nothing else should be needed. In case you are writing some registry entries, user under which server code will run should be able to modify the entries if needed.

You do not need a separate updater. What should happen is that on start of client, this data with DLL versions should go to server. If there are updates, splash screen opens up stating update in progress. During this time, server is busy replacing files on client computer. Once server has done this, it can notify client application. Then client should exit and start again on its own thus loading new DLLs.

In case there are no updates needed, server can just send back a success flag and then login etc can commence.

For new modules, I would assume you will need fresh installer or if the application is loose coupled and kind of plug and play like, then you may be able to push new modules too.

1 solution

ClickOnce[^] probably does exactly what you are looking for. However if you looking to write something on your own, here's an idea.

In client server based windows application that runs within the organization network, you can perform updates using following logic.

1. There must be file containing name and version numbers of all your DLL files.
2. When client application starts, before anything else, it sends content of file in #1 to server. DLLs are loaded on demand so I would recommend doing this as step one.
3. Server will have a similar file but with latest version details.
4. Server will check for version mismatch and if
a. Versions are same, success flag is sent to client application to continue.
b. In case of version mismatch, server will then push the latest files to client system. This will require a user account with privileges across the network which is generally not an issue in organizations. Once files are pushed, server sends back notification to client application which can then restart if needed.

In case your application is deployed on client networks, #1 through 4a remain same. However, 4b would change as following.

4b. Server notifies that DLL files are outdated and prompts user to update. If user choses to upgrade, they can download the files from server to the installation directory. In this case end user must have required access on his computer.

If you are creating newer modules, there can be two ways to deal with this.

1. Provide updated installer file to users. This would be viable solution assuming the assembly that runs first is also changed.
2. If you have a plug and play architecture where starting assembly is not affected even if you are adding newer modules you can go with same approach as you would for updates.

P.S. Should we delete the comment chain?
 
Share this answer
 
v2
Comments
HobbyProggy 12-Jan-16 1:58am    
Thanks again +5 for the effort :)
Let the comments stay, so one can see how it came to this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900