Application deployment when there are references to COM libraries

D

Demid

Hi, all.
I have recently written a small applpication that uses Microsoft CDO Library (cdo.dll)
that is a set of COM-classes. I have added a reference to this library using standard "Add
reference" dialog in Visual Studio, that has created required interop assemblies, and it
works fine on my computer. But when the application is launched on another computer, it
can not find this library (CDO) though it is properly installed and registered. I think
the main reason is that physical location of cdo.dll and msado27.dll (cdo depends on ado)
on that machine is different than in my system, because I used different drive letter to
install windows.
So, is it possible to make my application run on that computer, or is it possible to make
my application run on any computer that has all required dll-s registered no matter where
these dll-s are physically located, as it is common for win32 applications?
 
N

Nicholas Paldino [.NET/C# MVP]

Demid,

If you are distributing COM dlls, then you need to distribute the
install package for those DLLs. If the DLL is properly registered on the
target machine, then it doesn't matter where it is installed. COM objects
are registered in the registry, with their location, and are referenced by
program id, or class id (in the case of .NET, it is class id), and the
components are subsequently loaded from the location registered in the
registry.

Hope this helps.
 
D

Demid

Nicholas Paldino said:
Demid,

If you are distributing COM dlls, then you need to distribute the
install package for those DLLs. If the DLL is properly registered on the
target machine, then it doesn't matter where it is installed. COM objects
are registered in the registry, with their location, and are referenced by
program id, or class id (in the case of .NET, it is class id), and the
components are subsequently loaded from the location registered in the
registry.

Thanks for the answer. Unfortunally, my problem is slightly different than you understood.
I used COM technology long before C# and .NET appeared on the market and threrfore aware
of tips and tricks related to COM itself. Returning to the question - I do not need to
distribute DLL-s for the COM server I used, I assume instead that they are already
installed and registered on target computer. This might not be true for particular
computer, but it is undoubtadly true for the one I used to test my program.
In details it looks following:

public void WatcherProc()
{
...
Trace.WriteLine("Time to check test mail");
Trace.Flush();
CheckTestMail();
...
}

public void CheckTestMail()
{
Trace.WriteLine("Checking test mail");
Trace.Flush();
try
{
CDO.MessageClass lMessage = new CDO.MessageClass();
...
}
}

After running WatcherProc I read in a log file (that I configured for the trace listener)
line "Time to check test mail", but the line "Checking test mail" does not appear in that
file.
Instead I have a record in Application Event Log from .NET runtime:

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 27.07.2006
Time: 15:37:08
User: N/A
Computer: zzz-SERVER
Description:
EventType clr20r3, P1 dnwservice.exe, P2 1.0.0.0, P3 44c8b31e, P4 dnwservice, P5 1.0.0.0,
P6 44c8b31e, P7 15, P8 4a, P9 system.io.filenotfoundexception, P10 NIL.

For now I can only associate (probably mistakenly) that system.io.filenotfoundexception
with CDO.DLL library since no other external files are used in my project. Interesting
that the line of code "Trace.WriteLine("Checking test mail");" should be executed before
CDO.MessageClass is referenced (and error raised), but it is not. However when I comment
out all references to CDO.MessageClass in CheckTestMail() procedure, it works as intended
(of course, no useful work is done in that way).
 

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