IntelliSense in .fsx and dynamically loaded assemblies

When dynamically matching assemblies in .fsx using #I and #r , VS highlights the following types of imported types and writes: "The namespace or module" XXX "is not defined." This is normal?

For example, in the following code

 #I @".\Tools\FAKE" #r "FakeLib.dll" open Fake Target "Hello" (fun _ -> trace "hello!") Run "Hello" 

VS highlights Fake and says, β€œThe namespace or the Fake module is not defined,” it also highlights Target and Run . I have this problem in VS 2010 SP1 and in VS 11 CTP. This problem makes writing F # scripts more difficult than it can be.

By the way, IntelliSence works well for "regular" types. FakeLib.dll and FakeLib.xml are present in the .\Tools\FAKE directory. The code works well.

Update 1 Here is a screenshot of the situation. You can see that VS resolves the assembly FakeLib correctly (in a tooltip), and that at the same time the Intellisense "sees" the standard types (tooltip on the Console ).

enter image description here

Update 2 I think that something is wrong with IntelliSense on my workstation, because it (IntelliSense) behaves rather strange. When I launch VS and open the .fsx file, IntelliSense refuses to allow even standard types / classes, and it does not emphasize Fake classes, it does nothing. But after some period of time and some manipulation of the code, IntelliSense starts working for standard types and emphasizes Fake types.

In addition, when I created the same code on my home workstation, there were no problems, IntelliSense works as it should.

+6
source share
2 answers

If you put the full path in the #r directive, you get the full IntelliSense. The #I directive, although convenient, does not allow IntelliSense to work normally, although the code will work fine. This is true both for free scripts and for projects found in projects. Check out the Tomas Petricek project [FSharp.AsyncExtensions] (http://github.com/tpetricek/FSharp.AsyncExtensions].

+5
source

No, that’s not how it works. Is your code executing? Intellisense is provided for assemblies using #r .

+1
source

Source: https://habr.com/ru/post/897727/


All Articles