Reputation: 7105
I have a solution which contains 2 projects. One is a C++ wrapper for an external, third party library which is contained withing a series of Dll fies. The other is a C# project which references the C++ project via [DllImportAttribute].
What is the proper way to copy these Dlls so that they are found upon execution of the C# project? Are the typically registered with the system? Are all Dlls (both the external library and the C++ project) copied into the C# output folder?
How is this usually done? In a post-build step?
I'm sure there are a few ways to accomplish this, I just want to use the most common, trouble free approach. thanks.
Upvotes: 0
Views: 513
Reputation: 5986
Based on your description, you want to call c++ dll in c# app.
I write the detailed steps in the following link, you could have a look.
Upvotes: 0
Reputation: 27021
Generally Windows searches a dll in the same directory of the executable file first: https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order , so copy every dll files into this directory (the C# output folder in the case).
Upvotes: 1