Install COM using ClickOnce

  • Thread starter Alhambra Eidos Kiquenet
  • Start date
A

Alhambra Eidos Kiquenet

Hi misters,

I have installed my windows application that uses XpdfViewer (a COM
Component for view Pdfs) using ClickOnce.



But I get this error:



Message:
GRUPOBACKUP.Administrador.Pantallas.IndexadoAutomatico.frmIndexadoAutomaticoComun
-> ProcesarFicheroPDF. Unable to cast COM object of type 'System.__ComObject'
to interface type 'XpdfViewer.IXpdfViewer'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{59DF0320-224E-11D7-BD2E-08004608C318}' failed due to the following error:
Interfaz no compatible (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))..


at XpdfViewer.IXpdfViewer.loadFile(String pdfFileName)

at AxXpdfViewer.AxXpdfViewer.loadFile(String pdfFileName)

at GRUPOBACKUP.Componentes.LibreriaPDF.WrapperUCVisorPDF.LoadFile(String
pdfFileName)

at
GRUPOBACKUP.Administrador.Pantallas.IndexadoAutomatico.frmIndexadoAutomaticoComun.ProcesarFicheroPDF(DoWorkEventArgs e)





If I register manually Xpdfviewer using regsvr32 XpdfviewerCtr.ocx, my
application works fine. But I want and I need install the application using
ClickOnce.



In documentation of ClickOnce it appears:

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




In my Solution Explorer, I have two references:

AxInterop.XpdfViewer.dll has not Isolated property

Interop.XpdfViewer.dll has Isolated property and I set to True





Please, mister, any suggestions for install my application using XpdfViewer
with ClickOnce VS 2005 ??



Thanks in advanced, greetings.
 
M

Marc Gravell

Well, you can try registry-free COM, but frankly it is not simple to do.

With regular COM, if the tlb/dll isn't already registered at the client
then ClickOnce probably isn't a suitable deployment mechanism. ClickOnce
is designed to be /largely/ isolated and side-effect free, and COM
registrations don't meet this condition. Consider installing with an
installer msi instead.

Marc
 
M

Marc Gravell

I should clarify - many of these issues manifest when the referenced COM
library is part of non-trivial client install (for example using
multiple dll/ocx files). In this case, it may be preferable to get the
user to install the necessary files manually via pre-requisites.

Where possible, sourcing 100%-managed utilities is a simpler approach -
but I realise that this is not always possible.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top