Home » C# ProgrammingRSS

Deploying a C# COM DLL

A C# developer has created a C# COM DLL which I use in an IIS7 Native Module (C++). The problem is where to place this DLL. Unlike native COM which specifies the DLL location, the registry CLISD InprocServer32 entry for C# is a generic mscoree.dll.

I was first told to place the DLL in the same folder as the exe making the COM calls. That works but is unacceptable in my case.  This C# DLL is called by a native module DLL which runs under the IIS application w3wp.exe in the system32/inetsvr folder. I really want to avoid deploying to a windows system folder if at all possible.

I was next told to extend the PATH variable to include the directory where I want to place the DLL. This did not work. The path has no effect.

Is there another option for allowing the C# DLL to be located in a folder different from the exe?

 

2 Answers Found

 

Answer 1

Hi,

I am not sure, that I understood it completly right.

The regasm.exe has a /codebase parameter that could be used. http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.71).aspx, "Creates a Codebase entry  in the registry. The Codebase entry specifies  the file path  for an assembly that is not installed in the global assembly cache. You should not specify this option  if you will subsequently install the assembly that you are registering into the global assembly cache. The assemblyFile argument that you specify with the /codebase option must be a strong-named assembly."
==> But is it a com  Component or not?

You can register the DLL in the GAC. gacutil /i is the command required for that. Then the assembly is found in case  software is bound to it.

And the last thing you could do (but which I never did so far) is using the configuration file. So for example, you could modify the machine.config file. (http://msdn.microsoft.com/en-us/library/ms229697(VS.90).aspx) and specify the search paths in there (http://msdn.microsoft.com/en-us/library/4191fzwb(v=VS.90).aspx)

With kind regards,

Konrad

 

Answer 2

Thanks Konrad, those are very helpful suggestions which I'll try.
 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter