Hi,
I have a DLL that compile using VC 2005 using CLI. I pass this dll to VB team to use. They come back to me said that they can add a reference to the dll. A error stated "This is not a valid assembly or COM component."
Can someone help me to resolve this problem
Thanks & Regards,
Aaron Tan

C++/CLI Interop with VB.NET 2003
Staffan cronstrom LKP
Although I can specified which version of .net framework version during compilation of my DLL (see http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=361302&SiteID=1 for detail), by I still cannot add a reference to this DLL in my VB 2003 project.
JoCook
Can you add a reference from VC++ 2003 It might be that even if you're referencing 1.1 dlls in you c++ application, the IL that is emitted for the dll might be for the 2.0 version of the frameworks, and thus not be usable by older versions - if you can't reference your dll from vc++2003, I'm afraid I'm going to ask you to go and check with the C++ guys again.
Alex
WilliamW
Hi Aaron,
To interop between C++ and .NET - if your code is in the form of C-like APIs you can use Platform Invoke (pinvoke) (using DllImport attribute/Declare syntax from VB).
If your code is in classes, you can write it using Managed C++ (in which case the code will be compiled into a .NET assembly tht can be referenced from VB). Another approach is to embed your code inside a COM component and use tlbImport.exe to create a Runtime Callable Wrapper for your class.
Please look at the following thread for more info: http://www.codecomments.com/archive371-2005-3-433805.html
PInvoke Info:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnnetcomp/html/netcfintrointerp.asp
http://msdn.microsoft.com/library/default.asp url=/library/en-us/dv_vstechart/html/pinvoke.asp
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbcn7/html/vaconCallingWindowsAPIs.asp
More Interop Info
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcmex/html/vcconMCOverview.asp
Hope this helps!
Thanks
Otis Mukinfus
Dear ShyamN,
My classes was builded with C++/CLI in VC++ 2005 and it can be reference in VB 2005. Now the problem is I have users that still using VB.NET 2003 and they cannot add a reference to my DLL. Beside re-write it in Managed C++ and compile it in VC.NET 2003, is there any other option like compiler directive that allows me to compile my CLI classes that can be reference in VB.NET or C# 2003
Thanks for url pointers. I will try to browser it.
Regards,
Aaron Tan
PankajGautam
The VB folks would probably know more in such issue.
Thanks, Ayman Shoukry VC++ Team