473,473 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Interop call

Tim
I have a vb6 Exe. I need to call a C# dll's methods from the VB Exe. I have
used RegAsm to register the C# dll. If the VB6 Exe and the C# dll are in the
same folder, then everything is fine. But I want to place them in different
folders. When I place the VB6 Exe in a folder called 'A' and the C# dll in a
folder called 'B', the VB6 Exe throws the following error when it tries to
invoke the c# dll's method.

-2147024894 - Automation error.
The system cannot find the file specified.

What do I have to do to make it work?
Dec 22 '05 #1
6 3121
Put the asm in the new folder and reregister it. When you register dll,
actually you register a COM component ( VB6 sees your dll as a COM ).
Registration means that appropriate aliases a placed to the windows
registry. You can think of alias as
GUID <-> assembly path.

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
I have a vb6 Exe. I need to call a C# dll's methods from the VB Exe. I have
used RegAsm to register the C# dll. If the VB6 Exe and the C# dll are in
the
same folder, then everything is fine. But I want to place them in
different
folders. When I place the VB6 Exe in a folder called 'A' and the C# dll in
a
folder called 'B', the VB6 Exe throws the following error when it tries to
invoke the c# dll's method.

-2147024894 - Automation error.
The system cannot find the file specified.

What do I have to do to make it work?

Dec 22 '05 #2

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
I have a vb6 Exe. I need to call a C# dll's methods from the VB Exe. I have
used RegAsm to register the C# dll. If the VB6 Exe and the C# dll are in
the
same folder, then everything is fine. But I want to place them in
different
folders. When I place the VB6 Exe in a folder called 'A' and the C# dll in
a
folder called 'B', the VB6 Exe throws the following error when it tries to
invoke the c# dll's method.

-2147024894 - Automation error.
The system cannot find the file specified.

What do I have to do to make it work?


Use regasm with the /codebase option. Another option is to install the
assembly in the GAC.

Willy.
Dec 22 '05 #3
Yes, but you should register the assembly with the /codebase option set or
you have to install the assembly in the GAC. Remember that your assembly
classes are no COM objects and they don't become COM objects even after you
register them. What you do by running regasm is effectively registering
mscoree.dll as COM server, and it's up to this server to load the assembly
(and the CLR). To make it possible to load the assembly the assembly must be
stored in the GAC, or the assembly path must be registered as well, this is
achieved by the /codebase option.
Willy.

"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Put the asm in the new folder and reregister it. When you register dll,
actually you register a COM component ( VB6 sees your dll as a COM ).
Registration means that appropriate aliases a placed to the windows
registry. You can think of alias as
GUID <-> assembly path.

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
I have a vb6 Exe. I need to call a C# dll's methods from the VB Exe. I
have
used RegAsm to register the C# dll. If the VB6 Exe and the C# dll are in
the
same folder, then everything is fine. But I want to place them in
different
folders. When I place the VB6 Exe in a folder called 'A' and the C# dll
in a
folder called 'B', the VB6 Exe throws the following error when it tries
to
invoke the c# dll's method.

-2147024894 - Automation error.
The system cannot find the file specified.

What do I have to do to make it work?


Dec 22 '05 #4
Tim

Thank you for the response.

I tried the codebase option. But, now I am getting error at the next stage.

The process that I followed is as follows:

To explain in detail, the VB Exe refers a C# dll say 'A.dll'. 'A.dll' in
turn references another c# dll 'B.dll' and a C# exe 'C.exe'. I used VS2005
IDE to generate a strong name for 'A.Dll' , B.Dll and C.exe. I have used the
same strong name key file - say abc.snk. Is that okay or do I need to have
separate strong name key files for each of the assemblies?

Then I used the RegAsm utility with /Codebase option and /tlb option to make
the necessary registry entries and generate the tlb file.

Then I re-compiled the VB exe. When I run the VB exe from the same folder as
the Managed Dll's, everything works fine.

But, if I place the VB Exe in a folder say 'FolderA' and the managed
binaries in a different folder say 'FolderB', it throws an error.
The VB exe invokes methods on A.dll, A.dll in turn accesses methods on B.dll.

At that time, error occurs.
Error: -2147024894. Could not load file or assembly 'B', version=1.0.0.0,
Culture=neutral, PublicKeyToken=b941z50222f55471' or one of its dependencies.
The system cannot find the file specified.

And as per the requirement, I shouldn't place my modules in the GAC.

Where Am I going wrong?

"Willy Denoyette [MVP]" wrote:

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
I have a vb6 Exe. I need to call a C# dll's methods from the VB Exe. I have
used RegAsm to register the C# dll. If the VB6 Exe and the C# dll are in
the
same folder, then everything is fine. But I want to place them in
different
folders. When I place the VB6 Exe in a folder called 'A' and the C# dll in
a
folder called 'B', the VB6 Exe throws the following error when it tries to
invoke the c# dll's method.

-2147024894 - Automation error.
The system cannot find the file specified.

What do I have to do to make it work?


Use regasm with the /codebase option. Another option is to install the
assembly in the GAC.

Willy.

Dec 23 '05 #5

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...

Thank you for the response.

I tried the codebase option. But, now I am getting error at the next
stage.

The process that I followed is as follows:

To explain in detail, the VB Exe refers a C# dll say 'A.dll'. 'A.dll' in
turn references another c# dll 'B.dll' and a C# exe 'C.exe'. I used VS2005
IDE to generate a strong name for 'A.Dll' , B.Dll and C.exe. I have used
the
same strong name key file - say abc.snk. Is that okay or do I need to have
separate strong name key files for each of the assemblies?

Then I used the RegAsm utility with /Codebase option and /tlb option to
make
the necessary registry entries and generate the tlb file.

Then I re-compiled the VB exe. When I run the VB exe from the same folder
as
the Managed Dll's, everything works fine.

But, if I place the VB Exe in a folder say 'FolderA' and the managed
binaries in a different folder say 'FolderB', it throws an error.
The VB exe invokes methods on A.dll, A.dll in turn accesses methods on
B.dll.

At that time, error occurs.
Error: -2147024894. Could not load file or assembly 'B', version=1.0.0.0,
Culture=neutral, PublicKeyToken=b941z50222f55471' or one of its
dependencies.
The system cannot find the file specified.

And as per the requirement, I shouldn't place my modules in the GAC.

Where Am I going wrong?


By using /codebase you solved the COM issue, that is, the VB client can load
the 'assembly' through COM's native DLL load infrastruture (registry
based), but now you encounter an issue with the pure .net assembly loader
which doesn' use the registry to finf the assembly (it uses fusion). If the
GAC is not an option you should place the .NET assemblies in the path of the
client.
For more info on how .NET searches for assemblies, search MSDN for "How the
Runtime Locates Assemblies "

Willy.
Dec 23 '05 #6
Tim
Thanks Willy. That MSDN article provided the answer to my problem.
"Willy Denoyette [MVP]" wrote:

"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...

Thank you for the response.

I tried the codebase option. But, now I am getting error at the next
stage.

The process that I followed is as follows:

To explain in detail, the VB Exe refers a C# dll say 'A.dll'. 'A.dll' in
turn references another c# dll 'B.dll' and a C# exe 'C.exe'. I used VS2005
IDE to generate a strong name for 'A.Dll' , B.Dll and C.exe. I have used
the
same strong name key file - say abc.snk. Is that okay or do I need to have
separate strong name key files for each of the assemblies?

Then I used the RegAsm utility with /Codebase option and /tlb option to
make
the necessary registry entries and generate the tlb file.

Then I re-compiled the VB exe. When I run the VB exe from the same folder
as
the Managed Dll's, everything works fine.

But, if I place the VB Exe in a folder say 'FolderA' and the managed
binaries in a different folder say 'FolderB', it throws an error.
The VB exe invokes methods on A.dll, A.dll in turn accesses methods on
B.dll.

At that time, error occurs.
Error: -2147024894. Could not load file or assembly 'B', version=1.0.0.0,
Culture=neutral, PublicKeyToken=b941z50222f55471' or one of its
dependencies.
The system cannot find the file specified.

And as per the requirement, I shouldn't place my modules in the GAC.

Where Am I going wrong?


By using /codebase you solved the COM issue, that is, the VB client can load
the 'assembly' through COM's native DLL load infrastruture (registry
based), but now you encounter an issue with the pure .net assembly loader
which doesn' use the registry to finf the assembly (it uses fusion). If the
GAC is not an option you should place the .NET assemblies in the path of the
client.
For more info on how .NET searches for assemblies, search MSDN for "How the
Runtime Locates Assemblies "

Willy.

Dec 26 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
0
by: roy | last post by:
I try to call com written in VB 6.0. When I use VS.net Studio to do the debuging, some time it works fine, some time I got the following message: Server Error in '/GISOnlineReservation'...
0
by: roy | last post by:
I try to call com written in VB 6.0., some time it works fine, some time I got the following message: Server Error in '/GISOnlineReservation' Application....
1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
5
by: Eric St-Onge | last post by:
Hi all, I have a C# DLL containing only interfaces that I want to have a TLB (type library) generated for. For that I use the "Register for COM Interop" compiler option but it gives me the...
6
by: Sudha | last post by:
Hi All, I am trying to use COM DLL in my C#. I have added this DLL in referance and all interface are working fine. I have one issue in calling function decleared like: void...
2
by: Steve | last post by:
I'm using Visual Studio .NET (not 2003), and am developing a class that works with Word theough the Office PIAs (Interop). I can open word and do things with it programatically, but I can't close...
6
by: Nataraj1978 | last post by:
I have a requirement to use a dll written in Visual C++ 6.0 in my C# application. In order to establish the link between my application and the dll, I have written a ATL COM Component in Visual...
5
by: Richard Lewis Haggard | last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and pass these arrays as arguments to functions that are in a C# interop assembly. ASP complains because it doesn't...
5
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I've been tasked to translate a C# program to VB. (Dot Net 2.0.) I'm starting from scratch with no documentation and I'm trying to understand what the original programmer did. (The 'original...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.