deploying app with existing COM

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In this case I would like my application to be able to use exisiting
registered COM components. I dont want to re-register them.

While I am copying the interop DLL with the exe to the same directory, I get
a message that says the COM component or one of its dependencies cannot be
found.
[ This was for a simple one we developed using VB 6 ]

I also tried just using the File Scripting Object ( scrun.dll ), but that
also gave drove out a permission error.

What process should I follow ? I expected that the exe would find the
interop DLL and simply look at the registry and bind it .... Thanks
 
I also tried just using the File Scripting Object ( scrun.dll ), but that
also gave drove out a permission error.

if your script failed to create the VB6 object then it is not registered,
and therefore the interop won't work...
 
Hi Andrew,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have deployed your application
on a computer, a message that says the COM component or one of its
dependencies cannot be found. If there is any misunderstanding, please feel
free to let me know.

Generally, when this message appears, I think one of the COM component
you're interoping hasn't been registerd yet. We have to copy that COM DLL
to C:\Windows\System32, and register it with regsvr32.exe.

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Of the 2 instances of the problem, the com componet issue was caused by a
very specific reference to the interop DLL in the code ( complete path -
down VS Projects.. )

I had ... System.Relection.Assembly.LoadFrom(.....assemblypath/...);

when I recompiled with no path iml\plying the DLL is in the application
directory then it works.

BUT in the second instance - I simply made a COM interop DLL to the existing
SCRUN.DLL - then on the target machines I got a security violation.

The code inside is just 3 lines:

Scripting.FileSystemObjectClass FSO = new FileSystemObjectClass();
int numDrives = FSO.Drives.Count;
lblNumDrives.Text=Convert.ToString(numDrives);

So why would I get : System.Security.SecurityException ???
 
Hi

From you description, do you mean you have a .net application which will
use a SCRUN.DLL(a common com dll) to do some job, and on target machine you
get exception. If I have any misunderstanding, please feel free to post
here.

Also what is the exact error message? And which code line cause the
exception?

To isolate if the problem is caused by the CLR security check or underlying
win32 check, we can try to use the caspol tool to shut down the clr
security check.
caspol -s[ecurity] { on | off }
Turn security on or off

We can turn off the security check by running the code below.
caspol -s off

NOTE: this is for test purpose please enable the security check after test.
caspol -s on

For detailed information about caspol, please refer to the link below.
Code Access Security Policy Tool (Caspol.exe)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/htm
l/cpgrfcodeaccesssecuritypolicyutilitycaspolexe.asp

If this works after call(caspol -s off), we will know that the problem is
caused by clr security check.
You may try to run the application under same account and run on the local
machine, both the interop dll the managed app and the com dll will be on
the same machine.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
The error was caused when my remote testers did not include the interop DLL
in the same directory. Would be nice if teh .NET knew that or offered that as
a possible cause. THANKS
 
Hi Andrew,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top