One, DLL placed in the specified directory
In the programming of C # WinForm program, unavoidably a project will have multiple project files, and these project files are mutually referenced, so do not want to build the project (EXE or DLL) in the current project Bin directory of the debug directory or release directory, But in a common directory, such as the DllImport directory, how to implement the project, we know, if it is C + +, we can use CMake to deploy my project, also in C # can implement such a function, we only need in each project's "properties"----"Generate events" ----The post-build event command line, write the following code:
IF $ (configurationname) ==debug xcopy "$ (TargetPath)" "$ (SolutionDir) dllimport\debug\"/s/e/yif $ (configurationname) = =release xcopy "$ (TargetPath)" "$ (SolutionDir) dllimport\release\"/s/e/y
Related commands: Http://msdn.microsoft.com/zh-cn/library/42x5kfw4 (v=vs.90). aspx
Second, set the DLL call path
The app. Config file adds
<runtime>
<assemblybinding xmlns= "Urn:schemas-microsoft-com:asm.v1" >
<probing privatepath= "Libs"/>
</assemblyBinding>
</runtime>
Libs is the folder under the directory where the current program is located
DLL is placed in the specified directory and the DLL call path is set