Visual Studio 个项目的部署
Deployment of Visual Studio projects
我的问题很简单,我如何部署或发布我的 Visual Studio 与外部库特别是 OpenCV 库链接的项目。而且在其他电脑上可以运行
DLL
处理起来非常小心。正如您在评论中提到的,您应该将它放在可执行文件旁边。
Windows 在多个位置搜索您的 DLL
。在系统文件夹等以及放置可执行文件的文件夹中。为了可移植到其他系统并避免 windows 使用错误的 DLL
,您应该将它放在可执行文件旁边。
这 LINK 指出:
The standard DLL search order used by the system depends on whether safe DLL search mode is enabled or disabled. Safe DLL search mode places the user's current directory later in the search order.
...
If SafeDllSearchMode is enabled, the search order is as follows:
- The directory from which the application loaded.
2.The system directory. Use the GetSystemDirectory function to get the path of this directory.
- The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
- The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
- The current directory.
- The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
If SafeDllSearchMode is disabled, the search order is as follows:
- The directory from which the application loaded.
- The current directory.
- The system directory. Use the GetSystemDirectory function to get the path of this directory.
- The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
- The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
如果可能,您应该用绝对路径定义 DLL
。只是为了完整性。同样来自 link:
A system can contain multiple versions of the same dynamic-link library (DLL). Applications can control the location from which a DLL is loaded by specifying a full path or using another mechanism such as a manifest.
如评论中所述,您还必须包括 MVS 运行 时间 DLL
s。
我的问题很简单,我如何部署或发布我的 Visual Studio 与外部库特别是 OpenCV 库链接的项目。而且在其他电脑上可以运行
DLL
处理起来非常小心。正如您在评论中提到的,您应该将它放在可执行文件旁边。
Windows 在多个位置搜索您的 DLL
。在系统文件夹等以及放置可执行文件的文件夹中。为了可移植到其他系统并避免 windows 使用错误的 DLL
,您应该将它放在可执行文件旁边。
这 LINK 指出:
The standard DLL search order used by the system depends on whether safe DLL search mode is enabled or disabled. Safe DLL search mode places the user's current directory later in the search order.
...
If SafeDllSearchMode is enabled, the search order is as follows:
- The directory from which the application loaded. 2.The system directory. Use the GetSystemDirectory function to get the path of this directory.
- The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
- The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
- The current directory.
- The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
If SafeDllSearchMode is disabled, the search order is as follows:
- The directory from which the application loaded.
- The current directory.
- The system directory. Use the GetSystemDirectory function to get the path of this directory.
- The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
- The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
如果可能,您应该用绝对路径定义 DLL
。只是为了完整性。同样来自 link:
A system can contain multiple versions of the same dynamic-link library (DLL). Applications can control the location from which a DLL is loaded by specifying a full path or using another mechanism such as a manifest.
如评论中所述,您还必须包括 MVS 运行 时间 DLL
s。