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

后端 未结 3 1811
猫巷女王i
猫巷女王i 2021-02-19 18:14

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 namespa

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-19 19:05

    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
    

提交回复
热议问题