I have two projects with the full source code, one in C# and the other in C in one VS 2012 solution. The C# code is calling the C .dll via PInvoke.
I set the dependency on the solution level to tell the solution to build the C project before it builds the C# project.
Ideally, I would like to have the generated C .dll next to my executing C# dll, so I would refer to it by its naked name from my `DllImport`. However, this is not easy given that another project that is using my C# project will not copy the C .dll across. This problem would not exist if all my projects are .NET as MS Build will copy the .dll to the host.
> Are there any best practices or a magical VS option, that I am missing,
> to make the C .dll gets copied across in the same way that other
> .NET assemblies do?
This question is marked as a duplicate but it is not. The question referred to:
- It is talking about 3rd party .dlls, this one is about own project within the same solution.
- The accepted answer to that question doesn't take into consideration copying debug to debug and release to release.
- The accepted answer doesn't show how to copy through a chain of dependencies (C# -> C# -> C ).
I just found a solution which was inspired by https://stackoverflow.com/a/13944692/157017 which solves this specific situation.
Always Thank you. While some of the answers to that question apply to this question, but the question itself is asking about 3rd party dlls and not own project within the same solution.
以上就是VS Solution with C# project dependant on C project, best pratice的详细内容，更多请关注web前端其它相关文章！