5

我是编程cs脚本(csx文件)的新手。

但我的问题是我没有任何智能感知。如何在 Visual Studio 2015 中获得智能感知支持?

4

1 回答 1

5

Cs Script (CS file) and Script Cs (CSX file)

Cs-Script

It is a scripting engine that exists for quite a long time and use plain C# syntax (extension are hidden in comments). It also uses its own scripting engine.

There is an Intellisense extension for CS Script. However it states that it's for Visual Studio up to 2013 version, so maybe it is not compatible with 2015 version.

Script CS

... and CSI, Dotnet.Script and Nake

They are scripting engines based on Roslyn engine (and Mono REPL Engine for some of them). The syntax is extended:

  • No namespaces allowed
  • No main class, main method entry point not needed
  • Additional directives, like #load or #r to respectively load a script file and reference an assembly.
  • Common used using are not needed (like System or the like)

Obviously providing intellisense for such extended syntax is more complex and Support by Visual Studio 2015 Update 3 is not complete.

But it is available in Visual Studio Code through Omnisharp.

Note for Resharper Users:

You have to disable intellisense of Resharper for all Cs files (as R# see them as C# but cannot handle intellisense for them) and of course specify *.csx files as skipped by code inspection.

于 2016-11-05T04:21:51.503 回答