ClickOnce Information from User Group Meeting

Information was presented by Kate Gregory of Gregory Consulting Limited (http://www.gregcons.com/). Kate is a Microsoft C++ MVP and a Regional Director. Her email address is kate@gregcons.com.

Tip 1
Download optional files asynchronously using ClickOnce and System.Deployment.Application.ApplicationDeployment

Here is some example VB code:

Public Class Form1
Private WithEvents ad As _
System.Deployment.Application.ApplicationDeployment
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

ad = System.Deployment.Application.ApplicationDeployment.CurrentDeployment

ad.DownloadFileGroup(“sales”)

End Sub

Private Sub ad_DownloadFileGroupCompleted(ByVal sender As Object, _
ByVal e As System.Deployment.Application.DownloadFileGroupCompletedEventArgs) _
Handles ad.DownloadFileGroupCompleted

Dim f As New OnDemandForm.OnDemandForm
f.Show()

End Sub
End Class

The solution has two projects where the form in the second project is named OnDemand. This form would be only downloaded as needed.

The key is to use the matching downloadFileGroup to the download group in the application files setup in the Publish tab under the solutions properties. The settings for the above code look like this:

Tip 2
Use a system like SMS or other computer control software to push the first install of an application. Then use ClickOne to manage future updates. The key here is to NOT push your application, but a stub that calls ClickOnce after the install to perform the first install. The VB.NET framework class that manages this is called InPlaceHostingManager.

Tip 3
Use an MSI to create the initial install. Use CorLaunchApplication class to start the application from ClickOnce network server using the manifest. There is not currently a lot of documentation on this functionality.

Tip 4
Use Server Side Extensions to manage multiple versions of the application. You can use ASP.NET to create application manifests on the fly to allow users to have different versions of the application. We could have all IS Application developer point to a test server and all others point to the production server. This needs to be setup before the first install is done.

Note: There is a command line tool called MAGE UI that can be run to edit the manifests. This is included in the .Net SDK and does not need Visual Studio installed to run.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.