'Microsoft.CodeAnalysis.MetadataFileReference' is inaccessible due to its protection level

Topics: APIs, General
Nov 16, 2014 at 11:22 PM
Hi

I am trying to get a semantic model for a syntax tree as suggested in the document in the following way:
var compilation = CSharpCompilation.Create("HelloWorld") .AddReferences( new MetadataFileReference( typeof(object).Assembly.Location)) .AddSyntaxTrees(tree);
but then I get the error that 'Microsoft.CodeAnalysis.MetadataFileReference' is inaccessible due to its protection level. Any hint why this is happening?

thanks
Nov 17, 2014 at 12:14 AM
I found the answer by myself:

references: new[] { MetadataReference.CreateFromAssembly(typeof(object).Assembly) }
Marked as answer by TomasMatousek on 12/14/2014 at 5:15 PM
Nov 23, 2014 at 4:39 PM
Daniel,

I just wanted to thank you. I encountered this and it solved the problem.

MSFT folks, I did NOT find this via normal searches. I found it because I have the digest in my Outlook and I was searching Outlook. It's kind of late for a breaking change to be hard to find. Wherever else it is, I didn't run across it.

Kathleen