We currently have a product which happily runs across a network by
having various COM dlls installed on a shared network folder and
various client pcs use these dlls via an VB6 exe and also Excel
(2000/XP/2003) VBA. We don't have to install anything on the client
pcs apart from having to register the COM dlls (via regsvr32
"//server/sharedfolder/COMDll.dll") so that Excel (which runs locally
on each client pc) knows where to find them (i.e. on the shared
network folder).
We now want to start using .net dlls (exposed for COM via the "Make
assembly COM visible" checkbox) for any new code. My question is,
after installing the .net dlls on the server in the shared network
folder (//server/sharedfolder/), how can we most easily make them
available to client pcs?
My understanding is that we need registry entries to be added on each
client pc for each ClassID, ProgIDs etc exposed by the .net COM dll,
the assembly location etc. This is one of the things that a setup
program would do if we installed our application locally on each
client pc. But the whole
point of the network installation is that we don't want to have to
install the dlls locally on each pc.
I've already tried using regasm
"//serverpath/sharedfolder/DotNetCOM.dll" /codebase instead of
regsvr32 to register the .net COM dlls on the client pcs. In fact
what I have done more precisely is to use regasm
"//serverpath/sharedfolder/DotNetCOM.dll" /codebase
/regfile:"file.reg" to create a .reg file (file.reg) which can be run
on each client pc. This is probably better because otherwise problems
will arise if the version of regasm on the client pcs is different
from that on the server.
However: after testing this across the network using Excel 2003
VBA, I get an error message "Error 430: class does not support
Automation or does not support expected interface" the first time I
instantiate an object in VBA:
Dim obj as MyClass
set obj = New MyClass ' error 430 occurs here when the dll is across
network (but - see below - code works fine if dll is local)
Interestingly the error 430 disappears and VBA interacts happily with
the dll (I can call its methods etc.) if DotNetCOM.dll is moved to be
local to that pc (e.g. C:\localfolder\DotNetCOM.dll) and regasm rerun
(or the file.reg altered so that the path is changed to the local one,
or simplest of all, simply changing the codebase key value in the
registry to point to C:\localfolder\DotNetCOM.dll rather than
//serverpath/sharedfolder/DotNetCOM.dll).
Further information: I posted this question 3 days ago on an MSDN
forum (see http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=317267&SiteID=1),
but so far it doesn't look as if I'm going to get an answer from
there, and this is an important issue to us, hence am posting it here.
At the moment the DotNetCOM.dll assembly is not signed, and has not
been put into the GAC (Global Assembly Cache). This is because this
is not necessary as shown by the fact that calling DotNetCOM.dll from
VBA works fine with DotNetCOM.dll manually installed to local folder
C:\localfolder\DotNetCOM.dll as shown above. DotNetCOM.dll is a
Visual Studio 2005 C# dll which I created to test this (working across
the network) issue, with a very simple interface, with one method, Add
which adds two doubles together. I also know that the client machine
I am testing on has the .net 2 framework runtime expected by
DotNetCOM.dll, mscoree.dll version 2.0.50727. (I realise that if the
client pc only had an earlier version of the .net framework, then as
well as creating the registry entries via file.reg, I would also need
to install the newer version of the .net framework, but that is
obviously not contributing to the problem here since a) the .net
version on the client pc is up to date, and b) the dll works fine when
placed locally). The fact that the dll works locally presumably means
that the fact that so far I am not using a shim, i.e. the
InProcServer32 default key value is mscoree.dll, is not an issue
either. Another point is that marshalling, multi threading, cross
processes should not be an issue here, since the dll is an extremely
simple one (it is not an exe), and should simply be running inside
Excel.exe's process. I had always thought that to Windows, a shared
network folder is simply another drive, so I can't understand at the
moment why my simple dll works locally, but not when moved to the
shared network folder? |
Clarification of Question by
plucktick-ga
on
02 Apr 2006 01:24 PST
Given that I am no nearer a solution after 4 days, in spite of having
spent a lot of time on this myself, I am increasing the price of the
question from $50 to $100, and expanding its scope to answer what I
think is a related subquestion:
How (with ease of deployment and maintenance, updating etc. in mind)
is a pure managed (i.e. not exposed to COM) component supposed to be
deployed for use across a network? Is there a better alternative to
putting a copy of the component in each client pc's GAC (Global
Assembly Cache)?
At the moment, I think that the person or persons who know about this
subquestion will probably help shed light on my original (.net COM
component) question.
|