为什么Visual Studio不能找到我的DLL? [英] Why can't Visual Studio find my DLL?

查看:202
本文介绍了为什么Visual Studio不能找到我的DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2010中,在 VC ++目录>可执行的目录,我指定了路径到 glew32d.dll 。但是,当我运行可执行文件时,它仍然抱怨。

In Visual Studio 2010, under VC++ Directories > Executable Directories, I have specified the path to glew32d.dll. However, when I run the executable, it still complains.

另一方面,如果我将DLL复制到本地文件夹并运行可执行文件,请抱怨。

On the other hand, if I copy the DLL into the local folder and run the executable then, it doesn't complain.

有人可以告诉我如何解决这个问题?另外,为什么Visual Studio不能识别该路径?

Can someone please tell me how to fix this? Also, why is Visual Studio not recognizing that path?

更新
方案:我目前使用一个我使用的模板项目一个很多我的项目的启动器代码。此模板取决于glew32d.dll。我通常将所有相关的dll存储在通用的bin文件夹中。我希望参考这个文件夹,Visual studio可以从那里读取dll,而不是每次复制dll。这将是一个很好的方法来处理这个问题?

Update Scenario: I currently use a template project which I use as a starter code for a lot of my projects. This template depends on glew32d.dll. I usually store all dependent dlls in a common bin folder. I was hoping to reference this folder and Visual studio could read the dlls from there, instead of me having to copy the dlls everytime. What would be a good way to handle this?

推荐答案

在项目设置中指定DLL文件的路径不能确保您的应用程序将

在运行时查找DLL。你只告诉Visual Studio如何找到它需要的文件。一旦构建,该程序就没有什么

来处理程序如何找到需要的东西。

Specifying the path to the DLL file in your project's settings does not ensure that your application will
find the DLL at run-time. You only told Visual Studio how to find the files it needs. That has nothing
to do with how the program finds what it needs, once built.

将DLL文件放入与可执行文件相同的文件夹中是迄今为止最简单的解决方案。这是依赖关系的默认搜索路径,因此您不需要做任何特别的事情,如果你去那条路线。

为了避免每次手动这样做,你可以为你的项目创建一个Post-Build事件,

将自动复制DLL在构建完成后进入相应的目录。

Placing the DLL file into the same folder as the executable is by far the simplest solution. That's the default search path for dependencies, so you won't need to do anything special if you go that route.
To avoid having to do this manually each time, you can create a Post-Build Event for your project that
will automatically copy the DLL into the appropriate directory after a build completes.

或者,您可以将DLL部署到Windows 并列缓存,并在您的应用程序中添加一个指定位置的清单。

Alternatively, you could deploy the DLL to the Windows side-by-side cache, and add a manifest to your application that specifies the location.

这篇关于为什么Visual Studio不能找到我的DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆