共用方式為


Announcing Microsoft “Roslyn” June 2012 CTP

I’m happy to announce a new Microsoft “Roslyn” CTP release, which is available for immediate download here! Roslyn is our long-lead project to rebuild the entire C# and Visual Basic language compilers and Visual Studio language services from the ground up. Long lead projects like these allow us to make larger architectural changes in the product, and enable exciting innovation, while maintaining quality in the product along the way. You can learn more about the Roslyn project on the Visual Studio Developer Center or Soma’s blog. Roslyn is a significant endeavor with three key goals:

  1. Build a cleaner architecture across the compilers and IDE experiences. By exposing a set of public APIs from the compilers that the language services build upon, we’ll no longer need to duplicate code across the compilers and IDEs. Moving forward, this will give us much more agility when introducing new language features.
  2. Enable anyone to build tools or applications that deeply understand source code in the same way that the compilers and IDEs do. In the past, if you wanted to build a tool that works with C# or Visual Basic source code, you were pretty much on your own. Even creating something as simple as a tool to generate HTML for syntax highlighted code was hard. With Roslyn, building such a tool is significantly easier. In addition, Roslyn opens up new scenarios by providing APIs to enable application scripting, something that traditionally has been much more difficult.
  3. Create richer C# and Visual Basic IDE experiences in Visual Studio. Roslyn introduces a stream-lined refactoring experience and several new IDE productivity enhancements that focus on making it easy to make modifications to your code. You can even create your own refactorings! Also, Roslyn introduces a brand new Interactive Window (i.e. REPL, or read-eval-print-loop) that allows users to type code and see it immediately evaluated. This is a powerful way to explore a new API, try out an idea, or even build up pieces of an application.

Ultimately, by providing developers with the infrastructure to build richer “code smart” tools, Roslyn allows us to take the C# and Visual Basic language experiences beyond the current state-of-the-art.

In addition to providing support for Visual Studio 2012 RC, the June CTP includes several new language features and API updates.

Support for Visual Studio 2012 RC

Replacing a compiler that is responsible for running a big chunk of the Internet and rich client applications is not something one does lightly. Our general approach for re-architecting the compilers is to complete them before entering a product cycle. That way, we can use them and ensure they have high quality throughout the cycle. Because of this, Roslyn is not shipping as part of Visual Studio 2012 and will ship in a future VS release instead. However, we want to enable anyone who has VS 2012 installed to explore the Roslyn APIs and use the C# Interactive Window. To allow this, the CTP refresh will install on both Visual Studio 2012 RC and Visual Studio 2010 SP1 (note that VS 11 Beta is not supported).

New Language Features

We haven’t been sitting still and the list of language features supported by C# and Visual Basic is only growing in Visual Studio 2012. However, the Roslyn team is catching up quickly and has been implementing the C# and Visual Basic languages at an extremely fast pace. As each language feature is implemented, we continue to prove the Roslyn architecture by ensuring that it not only compiles, but has great API and IDE tooling support, and works in C# Interactive Window (pictured below).

clip_image001[1]

Since the last CTP, several language features have been implemented, such as query expressions, anonymous types, iterators, and many more!

Updated APIs

Since releasing the first Microsoft “Roslyn” CTP in October, we’ve received tons of great input and have made several positive changes in response to that feedback. A few highlights are listed below:

· New Code Formatting API to automatically format C# or Visual basic source code using the appropriate language formatting rules.

· New Find All References API to find references to symbols within a solution (pictured below).

· New Source Code Generation API to easily generate source code for C# and Visual Basic types and members.

· Numerous API clarifications, renames, and general improvements based on feedback received from the October 2011 CTP.

The following example shows using the new Find All References API to locate all of the references to System.String.

clip_image002[1]

Please note that due to the number of changes, most projects created with the October 2011 CTP will need to be updated to the latest APIs in order to work with them in the new June 2012 CTP.

Conclusion

For more information on the Roslyn project and to download the new CTP, you can visit the Roslyn home page on the Visual Studio developer center. We also invite you to discuss with the team on the Roslyn forum.

Enjoy!

 

Follow me at twitter.com/jlzander .

Comments

  • Anonymous
    June 05, 2012
    Nice to see solid progres on this very important and powerfull tool. Afetr completion (RTM) will it be available for free ?

  • Anonymous
    June 05, 2012
    "Nice to see solid progress" - @Tristan Agreed!! Keep it coming!  I'm excited to see what doors the final product will kick open!

  • Anonymous
    June 05, 2012
    @Tristan: Roslyn is the code name for the next generation of C# and Visual Basic compilers and Visual Studio language services. There isn't a plan to license this technology any differently than we do for the current compilers and language services.

  • Anonymous
    June 05, 2012
    Will there be a similar project for the F# compiler?

  • Anonymous
    June 05, 2012
    This sounds great - especially the C# interactive window which looks similar to the one in F#. It also looks to be perfect for application scripting.

  • Anonymous
    June 05, 2012
    How much of VS2010 does the Roslyn CTP "replace"?  I ask because I'd love to have the  C# Interactive window, but don't want to affect my actual code/output.

  • Anonymous
    June 06, 2012
    @Mr. S: When installed, the CTP adds the following to your primary Visual Studio install:

  1. The C# Interactive Window
  2. Project Templates for creating Roslyn extensions
  3. Editing support for .csx (i.e. C# Script) files
  4. Reference assemblies for the various Roslyn assemblies in the Add Reference dialog Installing Roslyn does not replace the C#/VB compilers or IDE experiences in Visual Studio. So, you can continue to use VS to develop software. Note that installing Roslyn does create a special instance of Visual Studio which replaces the C# and VB IDE experiences. However, that instance is only used when debugging Roslyn extensions that you create.
  • Anonymous
    June 06, 2012
    @bartsipes: For now, the Roslyn project is specifically targeted at the C# and VB languages. While any language can draft from the Roslyn APIs to create a similar object model, there isn't an active effort to do this for F# at the moment. That said, F# has a compiler written in managed code (i.e., in F#) with source code drops available at fsharppowerpack.codeplex.com.

  • Anonymous
    June 06, 2012
    I don't have VS2010 only VS2012RC install on my test win8 machine it won't install.

  • Anonymous
    June 06, 2012
    any idea if the Roslyn extensions extensible for VS add-ins? (maybe adding additional language support, adding syntax, changing formatting, etc?)

  • Anonymous
    June 06, 2012
    @vtp: Do you have the VS SDK 2012 RC installed? The Roslyn CTP won't install without the VS SDK, though the installer should have provided you with a link to download it. www.microsoft.com/.../details.aspx

  • Anonymous
    June 07, 2012
    @Scott Brickey: Roslyn does provide extensibility, but not for all of the scenarios that you mentioned. Changing or adding syntax to the C# and Visual Basic languages is not supported by Roslyn. However, you can build extensions to the C# and Visual Basic editing experiences using Roslyn. For example, you can create extensions for the source code formatting engine, for the syntax highlighter, the statement completion list, etc. You can even create new refactorings and quick fixes. For an example of creating a Roslyn extension, check out the "How to Write a Quick Fix" walkthrough. C#: msdn.microsoft.com/.../hh543922 VB: msdn.microsoft.com/.../hh543921

  • Anonymous
    June 09, 2012
    It seems like Roslyn setup picks up the VS2010 shell installed by SQL Server 2012 and refuses to install since no VS2010 sdk is present, even though I only have VS2012 RC (and sdk) full installed on my system.

  • Anonymous
    June 10, 2012
    Excellent.  I've been using Roslyn at SymbolicComputation.com for my Sym project so I'm glad to see you're moving forward with it.

  • Anonymous
    June 10, 2012
    @Greg Bachraty: Can you email me at kevinpi@microsoft.com so that we can investigate? Thanks!