2. Look Once to ClickOnce
How ClickOnce Works
Code: Get general information of current deployment
AutoUpdate Manually
Code: Check for Update
Code: Download and install new version
Code: Restart the application
Partially Deployment
ClickOnce Data Files
http://GreatFriends.Biz (c) Suthep S. 2
3. Code in VB
My.Application.Deployment
Code in C#
ApplicationDeployment class
in namespace System.Deployment.Application
[VB]
Dim v As Version
v = My.Application.Deployment.CurrentVersion
[C#]
using System.Deployment.Application;
Version v = ApplicationDeployment.CurrentVersion;
http://GreatFriends.Biz (c) Suthep S. 3
4. A brief understanding to ClickOnce deployment
as a very important feature of a .NET 2.0 smart client.
http://GreatFriends.Biz (c) Suthep S. 4
5. Good!
I don’t worry
about deployment
any more.
Good!
It’s
smart!
http://GreatFriends.Biz (c) Suthep S. 5
7. Is this a ClickOnce deployed application?
My.Application.IsNetworkDeployed (Boolean)
Code to get general information about current deployment
My.Application.Deployment (ApplicationDeployment)
CurrentVersion (Version)
UpdatedVersion (Version)
TimeOfLastUpdateCheck (Date)
DataDirectory (String)
IsFirstRun (Boolean)
UpdateLocation (Uri)
http://GreatFriends.Biz (c) Suthep S. 7
8. Have a deep understanding about the update process,
and take control to the AutoUpdate feature.
http://GreatFriends.Biz (c) Suthep S. 8
9. Check before or after
program starts
Scheduling
check for update
Minimum
required version.
http://GreatFriends.Biz (c) Suthep S. 9
10. Code to check for update
My.Application.Deployment.CheckForUpdate() (Boolean)
My.Application.Deployment.CheckForUpdateAsync()
My.Application.Deployment.CheckForUpdateAsyncCancel()
Code to download and install newer version
My.Application.Deployment.Update()
My.Application.Deployment.UpdateAsync()
Code to restart the application
System.Windows.Forms.Application.Restart()
http://GreatFriends.Biz (c) Suthep S. 10
11. Download and install a small core module first quicker,
then download and install other add-in modules as need later.
http://GreatFriends.Biz (c) Suthep S. 11
12. Click Application Files button in Publish pane
Set optional files to Include, Not Include (Auto),
and set it to a specific Download Group.
http://GreatFriends.Biz (c) Suthep S. 12
13. Code to check whether file group is already downloaded.
My.Application.Deployment.IsFileGroupDownloaded(group)
(returns Boolean)
Code to download a file group
My.Application.Deployment.DownloadFileGroup(group)
My.Application.Deployment.DownloadFileGroupAsync(group)
My.Application.Deployment.DownloadFileGroupAsyncCancel()
http://GreatFriends.Biz (c) Suthep S. 13
15. How to store data for a ClickOnce application?
It’ll lost after automatically update or not?
http://GreatFriends.Biz (c) Suthep S. 15
16. We can get directory for store data
that persist for ClickOnce application
My.Application.Deployment.DataDirectory (String)
Other means to DataDirectory
AppDomain.CurrentDomain.GetData(“DataDirectory”)
System.Windows.Forms.Application.LocalUserAppDataPath
http://GreatFriends.Biz (c) Suthep S. 16
17. ClickOnce makes Smart Clients come true.
Typically ClickOnce does not need special
configuration and coding.
We can manually check for update
and automatically install the new version
We can download ClickOnce partially at any time.
We should think about Data files
We have GUI utility named as MAGE
What we don’t covered:
Security, Associate File Extension, Using MAGE,
Custom Prerequisites, and other more advanced topics .
http://GreatFriends.Biz (c) Suthep S. 21
18. Article - Smart Clients: Windows Application for the Future
http://greatfriends.biz?29995
ขนตอนการ ทา Setup แบบ ClickOnce
ั้
http://greatfriends.biz?22612
บทความ - VB.NET Isolated Storage
http://greatfriends.biz?30793
Deploying .NET Applications
Learning MSBuild and ClickOnce
Apress Publishing.
Written by: Sayed Y. Hashimi
ISBN: 1-59059-652-8 (280 p)
http://GreatFriends.Biz (c) Suthep S. 22