0

I have a win32 cpp dll, and a c# project (PROJ_1), that use dllimport to call win32 dll functions. This dll included into project PROJ_1 and has build action as copy to output dir.

Another c# project (PROJ_2) references PROJ_1 and PROJ_3 references PROJ_2.

So, now we have something like this PROJ_3->PROJ_2->PROJ_1(dll)

So, when i make build in VS 2010: 1. In bin of PROJ_1 i have win32 dll. 2. In bin of PROJ_2 too 3. But in PROJ_3 - no win32 dll exists

What is the problem a how to resolve it?

3 Answers 3

1

If the projects are in one VS solution, do you have dependencies between projects correctly defined (right click project -> Project dependencies)? Are all the projects built for the same target architecture (64/86)?

As side question - Did you consider writing C++/CLI wrapper?

Sign up to request clarification or add additional context in comments.

3 Comments

Is it the best practice to use C++/CLI wrapper vs dllimport?
@cyssima I wouldn't go that far, but I have better experience with C++/CLI than with DllImport. There are situations where DllImport is impossible to use/would be very hard to use (for example complex APIs that return and accept objects, generic classes etc.).
Ah. Ok. So, going to my question: this is a one solution; dependencies are correct; actually target platform for these projects is x86, but in this solution there are others projects who builds in AnyCPU configuration.
0

I suggest, you add that unmanaged DLL to the PROJ3 solution and in the properties set "Copy to Output Directory" to "Copy always"

Comments

0

You could check the 'Copy Local' property of the reference to PROJ_2. In PROJ_1, add the win32 dll to your solution (no reference, just add it as a file just like a class in your solution) and set the properties Build Action = Content, Copy to Output Directory = Copy always.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.