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

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

问题描述

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


此应用程序无法启动,因为xxx。 dll没有找到。


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



有没有办法设置项目来查找(最好)一些相对路径的DLL文件(或不优选)一些绝对路径?



类似的概念,我们如何在项目设置中设置包含和库路径。



我的意思是当我调试我的应用程序(击中 F5 )将弹出上述错误。

解决方案


  1. 转到项目属性(Alt + F7)

  2. 在调试中,向右看

  3. 有一个环境字段。

  4. 添加相对路径(相对于vcproj文件夹),即.. \some-framework \lib,通过追加 PATH =%PATH%; $(ProjectD \some-framework \lib 或者前缀到路径 PATH = C:\some-framework \lib;%PATH%

  5. 再次点击F5(调试),它应该工作。


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

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

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

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.

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

解决方案

  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-framework\lib by appending PATH=%PATH%;$(ProjectDir)\some-framework\lib or prepending to the path PATH=C:\some-framework\lib;%PATH%
  5. Hit F5 (debug) again and it should work.

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

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