Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 844
Kapil Avatar asked Feb 07 '12 09:02

Kapil


People also ask

How do I use a third party DLL file in Visual Studio C#?

Right-click on References and select Add Reference... This will bring up the Add Reference dialog. Click on the Browse tab then navigate to the DLL you want to reference and click Ok to add the reference to your Project.

What is a third party DLL?

Third party DLLs are libraries created by other organisation outside of yours. You can use these third party DLLs by putting them into a folder in your solution and then creating a reference to it (Project-> Right Click-> Add Reference). Once you have the DLL, that DLL will have a namespace.

How do I add a reference to System Web DLL?

1 right click on References in Solution Explorer and press add reference... 2 choose the browse tab and go to C:\Windows\assembly\GAC_32\System. Web\System.


1 Answers

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
like image 157
pad Avatar answered Sep 27 '22 16:09

pad