简体   繁体   English

F#在.fs VS .fsx文件中编译VS Intellisense

[英]F# Compiling VS Intellisense in .fs VS .fsx files

Visual Studio 2015, same F# 4.0 Console application. Visual Studio 2015,相同的F#4.0控制台应用程序。 Two files, a Program.fs file and a Script.fsx script file with the same code: 两个文件,一个Program.fs文件和一个Script.fsx脚本文件,具有相同的代码:

open FSharp.Core
open Microsoft.FSharp.Collections

let seq = seq { 1 .. 3 }
let seqItem1 = Seq.nth(0) seq
let seqItem2 = Seq.item(0) seq
  • Program.fs will not compile: ".item" constructor method not defined. Program.fs将无法编译:未定义“ .item”构造函数方法。 No further messages from intellisense. 没有更多来自intellisense的消息。
  • Script.fsx works fine but Intellisense prompts that Seq.nth is deprecated, use Seq.item instead. Script.fsx工作正常,但智能感知提示说Seq.nth已被弃用,使用Seq.item代替。

In my case, this was due to the fact that I created the Project originally on VS 2015, but then for a while I had to work on VS2017. 就我而言,这是由于我最初是在VS 2015上创建项目的,但是后来我不得不在VS2017上工作一段时间。 When switching to 2017, FSharp.Core could not be found between the project references for some reason -- I then added another reference to it, however I (wrongly) kept the old reference to the dll. 切换到2017年时,由于某种原因在项目引用之间找不到FSharp.Core然后我添加了对它的另一个引用,但是我(错误地)保留了对dll的旧引用。

Switching back to VS2015 brought back the old FSharp.Core reference together with the other one added in VS2107. 切换回VS2015会带回旧的FSharp.Core参考以及VS2107中添加的其他参考。 This resulted in the behavior stated in the question. 这导致问题中所述的行为。

I still have to test whether bringing back the project to VS2017 will result in the FSharp.Core reference to not found again and the reason behind that. 我仍然必须测试将项目重新带回VS2017是否会导致FSharp.Core引用再次找不到以及其背后的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM