Reputation: 459
I have a litle but stupid problem. I started working with MS Roslyn, and I am trying to do the Walkthrough, but directly at the beginning an error occurred...
error CS0117: 'Roslyn.Compilers.CSharp.SyntaxTree' does not contain a definition for 'ParseCompilationUnit'
I do not understand why it occurred... maybe one of you had the same problem.
My Sourceode:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Roslyn.Compilers;
using Roslyn.Compilers.CSharp;
using Roslyn.Services;
using Roslyn.Services.CSharp;
namespace gettingstarted2
{
class Program
{
static void Main(string[] args)
{
SyntaxTree tree = SyntaxTree.ParseCompilationUnit(
@"using System;
using System.Collections;
using System.Linq;
using System.Text;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(""Hello, World!"");
}
}
}");
var root = (CompilationUnitSyntax)tree.GetRoot();
}
}
}
Upvotes: 7
Views: 1738
Reputation: 5767
@Anton to be shure, that is the newest one... You can use Nuget to install Roslyn.
Run the following command in the Package Manager Console : PM> Install-Package Roslyn
Upvotes: 0
Reputation: 11615
What is the date mentioned in the walkthrough you were following? The method was renamed from ParseCompilationUnit
to ParseText
for the September CTP. If you a previous CTP installed, it's possible that the walkthrough wasn't updated properly when you installed the latest CTP.
I would recommend uninstalling and reinstalling the CTP or using repair.
Upvotes: 5