如何添加第三方dll引用到F#项目? [英] how to add third party dll reference to F# project?

查看:85
本文介绍了如何添加第三方dll引用到F#项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向我的F#项目添加第三方dll引用.我将dll添加到了引用中,当我使用它时,即突出显示代码并执行Alt + Ent,我收到错误消息未定义名称空间或模块'AZROLESLib'".我错过了什么吗?

I'm adding a third party dll reference to my F# project. I added the dll in references and when I use this i.e highlight the code and do Alt+Ent, I get the error "The namespace or module 'AZROLESLib' not defined." Am I missing some thing.

推荐答案

简而言之,您必须使用#r "/path/to/AZROLESLib.dll"才能使F#Interactive识别并加载dll文件.

In short, you have to use #r "/path/to/AZROLESLib.dll" in order that F# Interactive recognizes and loads the dll file.

添加dll引用有助于Visual Studio在编译项目时查找正确的库,但与F#Interactive无关.因此,您必须使用#r指令指向AZROLESLib.dll.如果VS在突出显示代码方面遇到麻烦, 您可能需要在dll文件中打开确切的模块:

Adding a dll reference helps Visual Studio to find correct libraries when compiling the project, but it has nothing to do with F# Interactive. Therefore, you have to use #r directive to point to AZROLESLib.dll. If VS has some troubles to highlight the code, you may have to open the exact module in your dll file:

open AZROLESLibModule

如果代码在*.fs文件中,则可能要区分使用fsi和使用fsc:

If the code is in a *.fs file, you may want to distinguish between using fsi and using fsc:

#if INTERACTIVE
#r "/path/to/AZROLESLib.dll"
#endif

这篇关于如何添加第三方dll引用到F#项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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