‘Roslyn’ Offers Object Model for Code Generation, Analysis, Refactoring, Scripting

VS_h_rgbTraditionally, compilers are black boxes -- source code goes in one end, and object files or assemblies come out the other end. The Microsoft “Roslyn” community preview changes that model by opening up the VB and C# compilers.

Compilers in “Roslyn” provide APIs to allow tools and end-users to share in the wealth of information the compilers have about code. The Microsoft "Roslyn" CTP previews the new language object models for code generation, analysis, and refactoring, and the upcoming support for scripting and interactive use of C# and Visual Basic.

The CTP installs the following items:

  • Visual Studio Project Templates
    These project templates help you get started using the Roslyn APIs and building new Visual Studio extensions.
  • Reference Assemblies
    The Roslyn assemblies that can be added to projects via the Add Reference dialog.
  • C# Interactive Window
    A new tool window called C# Interactive is available in Visual Studio by invoking View -> Other Windows -> C# Interactive from the menu. You can explore by executing snippets of code in the C# Interactive tool window, cumulatively building up execution context as you experiment. In addition to typing directly into the tool window, you can also select code in C# and C# Script (.csx) files and invoke "Execute in Interactive" or "Copy to Interactive" from the context menu.
  • C# Script File Editing Support
    C# Script (.csx) files allow top-level statements much like the C# Interactive window. You can create a new C# Script file by invoking File -> New File -> > Script -> Visual C# Script from the Visual Studio menu. C# Script editing features like IntelliSense are powered by the Roslyn Language Service.

The Microsoft “Roslyn” CTP installs as an extension to Visual Studio 2010 SP1.

“Roslyn” is a long lead project which Microsoft is considering it for the post-Visual Studio 11 timeframe. The CTP includes an early preview of the APIs exposed by the C# and Visual Basic compilers, and the Interactive window experience.

Download the preview from Microsoft “Roslyn” CTP on the Download Center.

For more information, see Soma’s post  Roslyn CTP Now Available.

 

Bruce D. KyleISV Architect Evangelist | Microsoft Corporation

image