Thursday, October 05, 2006

If you need to publish your clickonce app from a webserver which does not have .net2.0 installed, there is a nice hack.You basically need to add two mime types to IIS which get installed automatically when you install IIS else it is not there.
The settings are for the ".application", ".deploy" and ".manifest" file extensions, and the MIME type for each should be set to "application/x-ms-application."
The following vbs file allows you to add mime types to IIS programatically.

Dim LocalMimeMap, MimeMap
Dim ExtensionToAdd, MimeTypeToAdd
Dim i
Const ADS_PROPERTY_UPDATE = 2
Set LocalMimeMap = GetObject("IIS://localhost/MimeMap")
MimeMap = LocalMimeMap.GetEx("MimeMap")
ExtensionToAdd = InputBox("Extension:","IIS")
MimeTypeToAdd = InputBox("MIME Type:","IIS")
i = UBound(MimeMap)+1
Redim Preserve MimeMap(i) 'Make it bigger and maintain its contents
Set MimeMap(i) = CreateObject("MimeMap") 'Add onto the end
MimeMap(i).Extension = ExtensionToAdd
MimeMap(i).MimeType = MimeTypeToAdd
LocalMimeMap.PutEx ADS_PROPERTY_UPDATE,"MimeMap",MimeMap

There is also a fast way of Switching Versions of the ASP.Net Framework here By Scott Forsyth

If you need to check whether the clickonce applications running on different machines are of the latest version available, its helpful to be able to see the publish version that any one machine is running. The code to do this follows. You'll also need to add System.Deployment into your project references.

If System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed Then
Dim ad As System.Deployment.Application.ApplicationDeployment =
System.Deployment.Application.ApplicationDeployment.CurrentDeployment
Dim version As String = ad.CurrentVersion.ToString
Me.Text = "Version: " & version
End If


Check out Saurabh Pant's weblog for information on Clickonce and Firefox