Is is possible to reference a C++ project in a C# Project? I've tried adding a reference in the c# project to that C++ one but I get an error saying "A reference to could not be added"
You cannot reference native DLLs directly. You could only if you compiled it for the CLI (targetting .NET CLR) or had build a COM component (in which case VS builds an interop DLL automatically). Otherwise no way, you would have to write a wrapper DLL.
If your C++ project is a native (standard C++) project, then no. If it's a managed project, you can add a reference to it.
For native code, you'll need to use P/Invoke to access functions within the C++ DLL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With