Visual Studio is missing reference to COM dll - c#

I have a project on C#. Furthemore I have a library that is developed on C++ and successfully built. I need to use that library in my C# project. So I registered C++ dll in COM and this is successfully registered and I can see it in registry in noe HKEY_CLASSES_ROOT/Wow6432Node/CLSID.
When I add reference to that COM dll in my project it is missing and I can't see anything from that library.
What the problem can be? Is it possible that if COM dll has any dependency and it require to reference it in my project?

Related

accessing external .net DLL from own .net 4.6.1 c# interop DLL

I need to modify my existing DLL in c# to interface between PowerBuilder 2017 (PB) and an external DLL developed by vendor. external.DLL is using .net 4.6.1
PB Target <-> my.DLL <-> external.DLL
I have set my.DLL up to be COM Interop enabled (Make assembly COM-Visible + Register for COM interop) and have previously set this to work in PB IDE without 'external.DLL' just fine by applying following commands:
regasm my.DLL
gacutil my.DLL (this is used only so PowerBuilder can access the DLL from within it's IDE)
Now, I try and reference external.DLL through my.DLL from PowerBuilder IDE I receive an error -3 code (Object could not be created).
How am I best to setup and also distribute both DLL files?
I think my issue is in setting up the References within Visual Studio 2017.
The COM interop is needed between PB and my.DLL.
I tried to add a follow Debug option as this would be helpful, but cannot trigger it.
Thank you for help.
I managed to get my.DLL working inside PowerBuilder IDE by using regasm on the external.dll and adding it also into the GAC.
For deployment of the PowerBuilder Application I expect to apply regasm to both DLL's and place them in same distribution folder.

Using Registration-Free COM Interop with a C# .NET DLL without codebase/GAC?

I have a C# .NET DLL that is exposed through COM Interop for which I have generated a manifest file. The DLL is being consumed through an Excel VBAProject using CreateActCtx and CreateObject to create my objects.
Everything works fine, however... I need to call regasm MyProject.dll /codebase or register with GAC. Otherwise I get ActiveX component can't create object or error in dll errors.
Is it possible to use a .NET DLL without having to register the DLL at all? I was able to do this previously with a VB6-based DLL and a manifest file.

Adding dll created in VC++ in C# 2010

I have a dll created in VC++ and visual studio 2005 now i want to add same dll in my C# application and VS2010.
But whenever i tried it gives me erro
"a reference to "../name.dll"could not be added please make sure that the file is accessible and that it is a valid assembly or com component"
Seems like C++ dll is native dll (and not managed C++/CLI)
You need to look at P/Invoke.
Platform Invoke Tutorial
DLL Import

Using COM dll in a C# Project

I have all COM dll generated from a C++ library project. I want to use it in my C# project. I guess, I should import the xxxLib.dll file from the C++ library project, and import it to my C# project. But this xxxLib.dll is not generated in my C++ project. But I could see that xxx.dll and xxx.tlb are generated
You just register the dll with regsvr32.
Then add a reference, go to the COM tab, and choose your COM dll.

statically linking multiple VC++ libraries to a C++/CLI dll

So I have this C# project that requires the use of some functions from a vc++ library. This vc++ library is then dependent on other vc++ libraries.
So in order to get this working, I created a c++/cli dll project that wrapped the main vc++ library. In the project linker settings, I just added the target vc++ library in the input field, and this resolved linker errors. I then added a reference to the cli project to the c# project references.
Everything compiled fine, but when I ran the C# project, there was a File.IO.Exception saying that the cli dll couldn't be loaded. After some tinkering around, I found that this error was happening because the wrapped vc++ dll dependencies could not be loaded. So I copied the vc++ dll into the same folder as the c# exe. I also had to copy all of the other vc++ dlls that the initial dll depended on.
Having to keep track of all of the VC++ dlls is burdensome, so I'm wondering if it is possible to statically link all of the VC++ dlls into the C++/CLI dll, so I do not have to copy them into the same folder as the C# exe. I tried adding all of the vc++ dependencies to the linker input field but that didn't do anything.
Thanks,
Alex

Categories