Use ClickOnce to Deploy Windows Applications2006

3.2. Updating Unmanaged Components Using RegFree COM

Visual Studio 2005 includes a new feature called RegFree COM (Registration-Free COM). Using RegFree COM, you can deploy an application that uses a COM component without needing to register it on the user's machine, so you avoid the notorious problems of "DLL hell." You can even have multiple versions of the COM component running side by side on the same machine.


Tip: RegFree COM works by automatically generating a manifest from the COM component's type library and component registration on the developer's machine. Therefore, while you're not required to install the component on your users' machines, a copy must be registered on the developer's machine.

To support RegFree COM, all COM components referenced in Visual Studio 2005 have a new Isolated property. If you set Isolated to TRue, then the component can be deployed through ClickOnce and Visual Studio 2005 will automatically do all of the work to deploy the COM component onto the target machine (without needing to register it on the target machine).

As an example, you can drag and drop an OCX control (such as Acrobat's PDF viewer control) onto your form and, under the References section in Solution Explorer (click the Show All Files button located second from left at the top of Solution Explorer), view the properties of the control (AxAcroPDFLib; see Figure 1-19), and set its Isolated property to TRue.

Figure 1-19. Setting the Isolated property of an OCX control for RegFree COM

That's it! You can now deploy the application using ClickOnce and Visual Studio 2005 will automatically take care of installing the OCX control on machines that do not have it.

Категории