如何在 Visual Studio 中设置 DLL 文件的路径? [英] How do I set the path to a DLL file in Visual Studio?

查看:112
本文介绍了如何在 Visual Studio 中设置 DLL 文件的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个依赖于 DLL 文件的应用程序.当我调试我的应用程序时,应用程序会抱怨:

I developed an application that depends on a DLL file. When I debug my application, the applicationwould complain that:

此应用程序无法启动,因为找不到 xxx.dll."

"This application has failed to start because xxx.dll was not found."

所以我必须将 DLL 文件复制到与我的 .vcproj 文件相同的目录中.

So I have to copy the DLL file into the same directory as my .vcproj file.

有没有办法将项目设置为在(最好)某个相对路径或(非首选)某个绝对路径中查找 DLL 文件?

Is there a way to set the project to look for the DLL file in (preferably) some relative path or (not preferred) some absolute path?

与我们在项目设置中设置包含和库路径的方式类似.

Similar concept to how we set include and library path in the project settings.

我的意思是当我调试我的应用程序(点击F5)时,上面的错误会弹出.

I mean when I debug my application (hitting F5) the above error would pop up.

推荐答案

  1. 转到项目属性 (Alt+F7)
  2. 在调试下,向右看
  3. 有一个环境字段.
  4. 通过附加 PATH=%PATH%;$(ProjectDir)some-frameworklib 或在前面添加您的相对路径(相对于 vcproj 文件夹)即 ..some-frameworklib到路径 PATH=C:some-frameworklib;%PATH%
  5. 再次按 F5(调试),它应该可以工作了.
  1. Go to project properties (Alt+F7)
  2. Under Debugging, look to the right
  3. There's an Environment field.
  4. Add your relative path there (relative to vcproj folder) i.e. ..some-frameworklib by appending PATH=%PATH%;$(ProjectDir)some-frameworklib or prepending to the path PATH=C:some-frameworklib;%PATH%
  5. Hit F5 (debug) again and it should work.

这篇关于如何在 Visual Studio 中设置 DLL 文件的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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