how to add third party dll reference to F# project?

女生的网名这么多〃 提交于 2019-12-04 00:40:52

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

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

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

for some things you can call them directly by name with no path

#r "EnvDte"

works for vs2013 here for instance

John

In my case my F# project was referencing a C# DLL but I had the same issue, "The namespace or module 'MyModule' not defined", when doing "open MyModule".

The solution was to edit the settings to use the same framework (one was using 4.5 and the other 4.0).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!