开发者

IntelliSense in .fsx and dynamically loaded assemblies

When dynamically referencing assemblies in .fsx using #I and #r, VS highlights the following usages of imported types and writes "The namespace or module 'XXX' is not defined". Is it ok?

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 module 'Fake' is not defined", it also highlights Target and Run. I have this problem in VS 2010 SP1 and in VS 11 CTP. This issue makes writing F# scripts a bit harder task than it could be.

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

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

IntelliSense in .fsx and dynamically loaded assemblies

Update 2 I think t开发者_运维问答here's something wrong with the IntelliSense on my work workstation, because it (IntelliSense) behaves itself quite strange. When I start VS and open .fsx file, IntelliSense refuses to resolve even standard types/classes, and it doesn't underlines FAKE classes, it does nothing. But after some period of time and some manipulation over code IntelliSense starts working for standard types and underlines FAKE types.

Moreover, when I've created the similar code on my home workstation there were no problems, IntelliSense works as it should.


If you put the full path into the #r directive, you'll get full IntelliSense. The #I directive, while convenient, prevents IntelliSense from working properly though the code will run just fine. This is true for both loose scripts and those found in projects. Have a look at Tomas Petricek's [FSharp.AsyncExtensions](http://github.com/tpetricek/FSharp.AsyncExtensions] project.


No, that's not how it works. Does your code run? Intellisense is provided for assemblies referenced using #r.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜