One of the biggest benefits from ClickOnce is that
users that do not have administrator permissions can install
applications. By the way, there are situations in which an application
is deployed together with some COM libraries but this can be a problem
because such libraries need to be registered and a non-administrator
user does not have the appropriate permissions for this. Fortunately
with ClickOnce you can take advantage of a technique known as
Registration-Free COM which basically makes a reference to a COM library
visible to the application only, without the need of registration. You
simply need to right-click the library name in Solution Explorer,
References and then select Properties. Finally set the Isolated property
as True (see Figure 1).

When you build the project, Visual Studio also
generates a manifest file that provides the actual state of isolation of
the library. Listing 1 shows a sample manifest file.
Listing 1. Sample Manifest for Registration-Free COM
<?xml version="1.0" encoding="utf-8"?>
<assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assem-
bly.adaptive.xsd"
manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1"
xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2"
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity name="Native.MyCOMLibrary" version="1.0.0.0" type="win32" />
<file name="wmp.dll" asmv2:size="11406336">
<hash xmlns="urn:schemas-microsoft-com:asm.v2">
<dsig:Transforms>
<dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>cCyT3Cw0dm68HkliYf3ncYjoCKU=</dsig:DigestValue>
</hash>
<typelib tlbid="{6bf52a50-394a-11d3-b153-00c04f79faa6}"
version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />
<comClass clsid="{6bf52a52-394a-11d3-b153-00c04f79faa6}"
threadingModel="Apartment"
tlbid="{6bf52a50-394a-11d3-b153-00c04f79faa6}"
progid="WMPlayer.OCX.7"
description="Windows Media Player ActiveX Control" />
</file>
</assembly>
|
The
manifest file is part of the setup process, so you need to include it
in your ClickOnce deployment (Visual Studio takes care for you). If you
are interested in understanding how the Registration-Free COM technique
actually works, you can read a specific article in the MSDN Magazine
available at this address: http://msdn.microsoft.com/en-us/magazine/cc188708.aspx.