Learn Roslyn Now: Part 1 Getting Roslyn

Roslyn is deployed as a NuGet package.

Navigate to: Tools > NuGet Package Manager > Package Manager Console

Paste the following: Install-Package Microsoft.CodeAnalysis

A complete walkthrough of installing other Roslyn tools maybe found below:

 

10 thoughts on “Learn Roslyn Now: Part 1 Getting Roslyn

  1. Thank for you this incredibly crisp and precise introduction, it saved many hours to just see what you know you want to see. I want to write something that will let me take a subset of C# and convert it to a C program that will run on an embedded device.

    John Mott
    CTO Surge Holdings

  2. Thank you for your reply. If I don’t misunderstand your meaning that I can use only .netcore SDK and two packages (MS.CodeAnalysis & MS.CodeAnalysis.CSharp) to finish my basic C# static analysis (syntax level & semantic level) ? Also I can use MSBuildWorkspace to deal with .sln file rather than analyze single C# file again and again. I am not sure is that right? I hope you can give me some tips if I misunderstand some concepts.

    1. I’m not sure if the MSBuildWorkspace can be used. At the very least you will probably have to install MSBuild on your computer in order to use it. I’ve never actually done this on Linux or Mac myself but I know Visual Studio for Mac uses Roslyn.

      You can definitely analyze C# syntax trees cross-platform without Visual Studio. If you can’t use the MSBuildWorkspace, you might be able to use the AdHocWorkspace, but you would have to add the source files (and referenced DLLs) yourself.

      1. OK. I know how to use AdHocWorkspace to add source files(DLLs) from your blog and some other articles. I have one question that if MSBuildWorkspace have to install MSBuild compiler and what the compiler I need to use with AdHocWorkspace? As I known, VS has default csc compiler to do that. So I a am confused with that.

  3. How do you get these variable value strings to the right while typing in Visual Studio? Have never seen that before and seems super useful.

Leave a comment