Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how i can add third party dll(dll is in c language) to visual studio 2012. right now when i add it it gives me error that
"dll can be added. make sure that file is accessible and that is a valid assembly or COM component"
Posted
Comments
Sergey Alexandrovich Kryukov 20-Sep-14 14:24pm    
To Visual Studio or your project? Then Visual Studio is totally irrelevant. It does not even perform build, MSBuild does.
—SA
maheshbisht 20-Sep-14 14:30pm    
My project platform is Visual Studio 2012
Sergey Alexandrovich Kryukov 20-Sep-14 15:24pm    
I did not ask about that, this is also irrelevant. (Look, to start with, you have to learn what VS does, what CLR does, what JIT does, what build does, what's your source code and what is assembly, what uses what...)

I answered in full. Are you going to accept the answer formally?

—SA
maheshbisht 20-Sep-14 15:33pm    
sir i know that when there is any third party dll the we add have to register it with our system but want to know how?
[no name] 20-Sep-14 15:38pm    
You don't. You use P/Invoke to access that type of DLL.

1 solution

It's not clear what did you try to do, but chances are, you tried to use a "plain" native (unmanaged) windows DLL. If your DLL is a main module of some valid .NET assembly or COM component, you can just add the reference using "Add Reference" window ("COM" tab for COM component). If it is not, you can use P/Invoke:
http://en.wikipedia.org/wiki/Platform_Invocation_Services[^],
http://msdn.microsoft.com/en-us/library/ms235282.aspx[^].

This CodeProject article can also be useful: Essential P/Invoke[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900