I made a DLL in C++, compiled it just fine, imported the DLL and LIB files into a C# project in VS2012, used the System.Runtime.InteropServices, and attached a [DllImport("DllName.dll")] attribute to the function I wanted to test, making sure the function name and data types match correctly and that it is a static extern function, then tried to call the function.
Everything compiled fine without any errors, but then when I run it, as soon as it gets to the line that calls the function, it crashes with a DllNotFoundException. I'm assuming that it's trying to load in the DLL automatically just before it needs to use it, right? That's fine, but for some reason it can't find it, even though I placed it in the project and it appears inside VS2012, along with the LIB file. I also tried changing the extension in the DllImport string to be .lib instead of .dll, and I still get the same error.
So does anyone know what I did wrong?