I have a .net cf 3.5 Windows Mobile application that my client wants to have autoupdate features.
Here is what I have so far:
- create a CAB using the Smart Device CAB Project (is this good enough, or should I be doing something else here)
2.Get the application version number
Assembly.GetExecutingAssembly().GetName().Version.ToString();
- Call a WCF web service for to do a version number look up.
- Download a new version of the cab file.
- ???
- Execute WCELoad.exe on the CAB file
- Profit
I just published WmAutoUpdate, a .NET c# framework that will do auto-updates on the Compact Framework. It's freely available on Github: http://github.com/seboslaw/wmautoupdate
Your solution is generally correct, but has a few problems.
- You can't update yourself. You have to shut down and have some otehr app update you to prevent the file-sharing issue. This is usually handled by having a dedicated "updater" app that you launch. It might be the target of the app icon and therefore does updates with every launch, or it may be launched via a "check for updates" type of menu item. Regardless, you have to launch it and make sure the actual app isn't running.
- It's generally a good idea to provide some form of back-up in the event of a corrupt, interrupted install
- CAB updates are going to require wholesale updates of everything. This may not be what you want in the end (you may want to update just a single file, assembly or whatever) so starting with the logic of pulling down individual files is going to make you way more extensible.
An old, but still very valid, resource is Alex Feinman's MSDN article on creating self-updating applications.