Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
Xeross155
Minmatar Fusion Death Inc. Intrepid Crossing
|
Posted - 2010.02.19 12:21:00 -
[1]
Hey,
I know this ain't a programming forum but as I've seen this in a host of EVE tools I'm gonna ask it here anyways.
I'm working on a launcher for a game, and I want the launcher to be able to update itself. I've so far moved all the application logic into DLL files because I thought it could overwrite its own DLL files.
However after even just trying to read it I get an IO error because it is in use, however in explorer I can move, delete, rename, whatever it just fine.
So how do you guys make your applications update-able do you use a seperate executable for updating, somehow manage to make it overwrite it's own dll files ?
And lastly I'm using C# but I guess any implementations in other languages can be ported, and no I don't want to use ClickOnce.
Thanks, Xeross --------------------------------------------- Xeross' ventures into EVE |
Hel O'Ween
Men On A Mission
|
Posted - 2010.02.19 12:41:00 -
[2]
Regardless of the method (seperate app, downloading to temp files) you choose, the appliaction in need of the update, needs to be terminated in order to replace the files in use.
To me, the easiest way seems to be a seperate updater appliaction. It starts, checks for updates, if any updates are available, check if the main appliaction is running, if so, terminate it and do the updates.
The "check for updates" part could also be done by the main appliaction. If update availabe -> start updater and terminate itself.
This way, you save yourself from the step "save updates with a different name/to another folder and make sure before the next start of the appliaction, everything is moved in the right place. -- EVEWalletAware - an offline wallet manager |
Amida Ta
German Mining and Manufacture Corp.
|
Posted - 2010.02.19 12:53:00 -
[3]
Well clickonce would provide that "for free", but if you want to do it yourself either implement it completely yourself (the posting above already gives the basic idea) or use a library/building blocks like: http://msdn.microsoft.com/en-us/library/ms978574.aspx (Updater Application Block) _________________________ EveAI.Live - The EVE-Online API/class library for .Net, C# and VB.Net |
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2010.02.19 17:00:00 -
[4]
Something I'd recommend especially for anything that's open source and multiple platform is http://installbuilder.bitrock.com/ as it's available free and very easy to use and takes care of all the details for you or let's you customize it. It include an updater which can be used just to alert the user to new versions manually or automatically or even automatically update your application when there's a new version available. It works with any language and has some very advanced features that should cover any needs you have. They also seem to have a very good support system that so far had a live person contact me within 48 hours and usually 24 hours when reporting issues. Of the couple issues I've had most have been caused by me not understanding something about how it worked and in every case they've explained it and when there was an actual problem with the installer they've released an update within a couple weeks and always followed up to make sure it fixed the issue. In other words they understand how to do customer service right and really do want to improve their product. Anyway that's my 0.02 ISKs on it ;) -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
Xeross155
Minmatar Fusion Death Inc. Intrepid Crossing
|
Posted - 2010.02.19 18:28:00 -
[5]
What I first wanted was that the application could overwrite its own DLL files, I've tested that within my explorer (While the app is running) and could swap out the DLL files just fine, however when trying that in my application it somehow can't which I find is weird. --------------------------------------------- Xeross' ventures into EVE |
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2010.02.19 19:06:00 -
[6]
The way that windows keeps track of DLLs is with a counter somewhere in the Registry and doesn't want to let you delete them until the counter is back to 0. Additionally you can't delete a file that is currently being used so in your application since you've included the DLL it can't be delete by it you would need to start a separate process without the dependency and exit so it could update them. There are also ways to have them update on next reboot but that should only be used for things like device driver etc that really can't be change while the system is running. The reason I suggested InstallBuilder is it takes care of most of those issues for you so you don't have to worry about it but there are many ways to do it you just need to do a little more research and I'm sure you'll find something that work for you. Since you're using C# which probably means you're using .Net as well I'd look to see what it has available to help with updates as I'm sure there's something in it to do so. -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
Xeross155
Minmatar Fusion Death Inc. Intrepid Crossing
|
Posted - 2010.02.19 20:19:00 -
[7]
Edited by: Xeross155 on 19/02/2010 20:19:14
Quote: I've tested that within my explorer (While the app is running) and could swap out the DLL files just fine (Move, Rename, Delete, Replace).
Though I dont understand why it works in explorer while it doesnt work in the app :/
I'll probably end up using a little helper app to replace etc. --------------------------------------------- Xeross' ventures into EVE |
Catari Taga
Centre Of Attention Rough Necks
|
Posted - 2010.02.19 20:29:00 -
[8]
Originally by: Xeross155 Edited by: Xeross155 on 19/02/2010 20:19:14
Quote: I've tested that within my explorer (While the app is running) and could swap out the DLL files just fine (Move, Rename, Delete, Replace).
Though I dont understand why it works in explorer while it doesnt work in the app :/
I'll probably end up using a little helper app to replace etc.
Might depend on the programming language you are using and/or the method you used for deleting it. As long as you unloaded a dll you should be able to replace it but since you might run into the situation where you want to replace a core file of your application an external updater is usually the easiest solution anyway.
|
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2010.02.19 20:41:00 -
[9]
Don't know what to tell you because it usually won't let explorer do that while it's being actively used. Just as a wild guess maybe explorer is running at a higher privilege level and could override it in this case. My experience has been it doesn't let you do that but as you've seen there doesn't seem to be any hard and fast rule what can and can't be done by a different process. I'm sure in part that it depends on what the DLL is used for and how it's included/called. Where it is can also make a difference in that ones in the common system directories should have stricter requirements for making changes but I could be wrong as that might be something I'm use to from Linux where most of the common libraries can only be managed by the superuser (root). From what I've seen it's common practice from every application just to include their own versions of every library (DLL) and just throw them all over the system without regards to wither that might break something else -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
Vessper
SI Radio
|
Posted - 2010.02.19 22:05:00 -
[10]
Originally by: Xeross155 Edited by: Xeross155 on 19/02/2010 20:19:14
Quote: I've tested that within my explorer (While the app is running) and could swap out the DLL files just fine (Move, Rename, Delete, Replace).
Though I dont understand why it works in explorer while it doesnt work in the app :/
I'll probably end up using a little helper app to replace etc.
It might depend on whether the app has right appropriate access rights to the folder. I have seen in cases in Vista/Win7 that when a file has supposedly been written to a directory (say, Program Files), it ends up in the VirtualStore folder instead of the correct one. In these cases, you need your app to be running as Administrator to complete successfully.
What I do with my app is as follows:
1. The main app checks for updates and downloads them to a temporary folder that has full access e.g. the users documents or AppData folder 2. The main app downloads an updater app and places it in the same temporary folder 3. The main app runs the updater app with elevated priveleges (UAC required in Vista/Win7) 4. Update app closes the main app and waits for confirmation 5. Update app copies files from the temporary location to the main app location, overwriting where required 6. Update app asks user if they want to launch the updated app
Hope that is of some help to you.
EveHQ Character App |
|
Amida Ta
German Mining and Manufacture Corp.
|
Posted - 2010.02.19 22:20:00 -
[11]
Originally by: Xeross155 Edited by: Xeross155 on 19/02/2010 20:19:14
Quote: I've tested that within my explorer (While the app is running) and could swap out the DLL files just fine (Move, Rename, Delete, Replace).
Though I dont understand why it works in explorer while it doesnt work in the app :/
I'm pretty sure this is not a difference between explorer and the functions you use but of the different states your application is in.
You CAN replace the .dll files as long as they haven't been used yet (thats why they are called "dynamic" *g*). Just starting your application might not use the dlls, so until you do you can delete/move/replace them. However as soon as you use them they are loaded into the process and you can no longer delete the files as long as the process is running. In fact thats not entirely true either. For .Net you could load them into seperate AppDomains, unload these and then replace the .dlls while the application is running. However this is likely to be (much) more work then just using any existing or the extern updater.exe approach.
And by the way: No, there is no refcounting for .Net DLL files. _________________________ EveAI.Live - The EVE-Online API/class library for .Net, C# and VB.Net |
Xeross155
Minmatar Fusion Death Inc. Intrepid Crossing
|
Posted - 2010.02.19 22:48:00 -
[12]
Based on what you all are saying I think it's possible to move and delete the DLL files as long as they aren't being actively used, I tried overwriting the DLL from within the DLL itself but it might be that when I try it from the main app or something it does work.
I'll just go with the external updater thing, just need to figure out how to get the MD5 hash of a file that's marked as in use. --------------------------------------------- Xeross' ventures into EVE |
Dr BattleSmith
PAX Interstellar Services
|
Posted - 2010.02.22 06:31:00 -
[13]
InstallBuilder looks good.
Deployment of software which works on computers with such varied pre-installed software and drivers is probably the hardest thing in programming.
Writing your software takes ages, but getting deployment correct can take even longer.
I'd suggest going with a package like this rather then roll-your-own.
|
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2010.02.22 16:11:00 -
[14]
Just had to say InstallBuilder has builtin function for MD5 but generally you shouldn't need it. They do offer a trial version which is fully functional just limit project name and includes in any installer you make with it popups etc saying it was made with trial. I do suggest trying before buying or getting free license for open source projects just to make sure it's what you need. I wasn't sure until I started reading through some of the KnowledgeBase articles and saw some of the things it can do. -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
Amida Ta
German Mining and Manufacture Corp.
|
Posted - 2010.02.23 11:49:00 -
[15]
BTW: If you are targeting Windows (mainly) I would strongly advice against Installbuilder. It just sucks BIG TIME for windows. In fact it doesn't even create real installations and just does copying. One of the worst tools out there... _________________________ EveAI.Live - The EVE-Online API/class library for .Net, C# and VB.Net |
Ambo
I've Got Nothing
|
Posted - 2010.02.23 14:56:00 -
[16]
I wrote my own, it was c# as well so if your interested in some snippets then check out the source code on google code or give me a shout and I'll point you to the relevant bits.
It's very basic but gets the job done. After some initial problems, it's now very stable and I've not had any issues with it for a long time. (none that weren't caused by me uploading the wrong files at any rate..)
As an overview, it does what others have suggested and uses a seperate updater application. In simple terms it works like this:
1) Check for updates in main app. 2) If there are updates available, copy updater exe to temp location, run it and terminate the main app. 3) Updater downloads new files and copies them over the old ones (note because it's in a temp location, this can also update the updater itself)
--------------------------------------
|
Tonto Auri
Vhero' Multipurpose Corp
|
Posted - 2010.02.23 15:51:00 -
[17]
Originally by: Hel O'Ween Regardless of the method (seperate app, downloading to temp files) you choose, the appliaction in need of the update, needs to be terminated in order to replace the files in use.
Not necessarily. I'm, usually, going this way: 1. Rename files I'd be replacing. (Of course, properly handling success/failure) 2. Write new files. 3. Add old files to delete-at-boot Windows script. 4. Tell user to restart application and notify that reboot is strongly advised. -- Thanks CCP for cu |
Etil DeLaFuente
Destructive Influence IT Alliance
|
Posted - 2010.02.23 21:26:00 -
[18]
Shadow copy : "Shadow copied applications aren't locked by the loader, so they can be updated/substituted at runtime."
Shadow copy explained : http://msdn.microsoft.com/en-us/library/ms404279.aspx
Have a look here for some source code http://www.codeproject.com/KB/install/ShadowCopy.aspx
enjoy
|
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2010.02.24 12:04:00 -
[19]
Quote: BTW: If you are targeting Windows (mainly) I would strongly advice against Installbuilder. It just sucks BIG TIME for windows. In fact it doesn't even create real installations and just does copying. One of the worst tools out there...
Amida Ta - If it's so worthless they have sure fooled a lot of companies http://installbuilder.bitrock.com/customers.html First 99% of all installers that's all they do but it also works with the registry, does editing of files, download files from URL, start web browser, works with ini file, registers you program with windows, RPM, or DEB ... I could go on but since you don't have a clue what you're talking about I wouldn't pirate this thread any more and direct anyone that actual care to find out want it can do to have a look at their web site http://installbuilder.bitrock.com/index.html
-- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
Amida Ta
German Mining and Manufacture Corp.
|
Posted - 2010.02.24 12:17:00 -
[20]
Originally by: Dragonaire
First 99% of all installers that's all they do but it also works with the registry, does editing of files, download files from URL, start web browser, works with ini file, registers you program with windows, RPM, or DEB ...
Yes RPM and DEB for Linux and what is with the Windows counterpart MSI? Nope, not used and not supported.
Originally by: Dragonaire
I could go on but since you don't have a clue what you're talking about I wouldn't pirate this thread any more and direct anyone that actual care to find out want it can do to have a look at their web site http://installbuilder.bitrock.com/index.html
I find it sad that you have to get personal, especially as it is simly untrue and especially from you. I have even used their installer before. Fact is it doesn't even know MSI. Which IS the windows installation/package system. I'm sure we can agree that the times when stupid installers just copied files wildly all over the place (including system files) are thankfully over and I cannot understand promoting an installer that brings EXACTLY that back (on windows, because strangely enough on LINUX it even supports MULTIPLE package systems - why don't they use their proprietary copying there, but do actually follow the rules??). _________________________ EveAI.Live - The EVE-Online API/class library for .Net, C# and VB.Net |
|
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2010.02.24 13:07:00 -
[21]
Quote: It just sucks BIG TIME for windows. ,,, One of the worst tools out there...
When you start off saying things like that about stuff others find useful or like you can expect to get flamed but to go on with the rest of what you said. If you have already made a MSI why do you need an installer? There's already software out there to make them including I believe some for free from MS. I'll agree that copying stuff all over the file system is not really a great way of doing things but just because you use a MSI, RPM, or DEB doesn't mean you can't still do that. In the end it comes down to whomever is deciding were to put stuff to follow the rules no matter what platform you're on. I personally learned several things I hadn't know about were stuff is suppose to go on Windows as well as Linux and then largely ignored it with Yapeal One of the reasons I decided on InstallBuilder was first of all it's cross-platform just like Yapeal and could be used from a SSH connection/ CLI all the way up to GUIs for more platforms than EVE will ever be able to run on. If you are only going to limit yourself to a single platform then there are probably better ones to use for all of them. So in the end no matter what you end up using you can shoot yourself and your users in the foot so it's up to you to avoid it -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |