kavics
kavics

Reputation: 433

MetadataFileReference is inaccessible

I recently updated my project to Roslyn 1.0, and can't find MetadataFileReference class anywhere.

references: new[] { new MetadataFileReference(typeof(object).Assembly.Location) }

Error   CS0122  'MetadataFileReference' is inaccessible due to its protection level

What can I use instead?

Upvotes: 9

Views: 2265

Answers (2)

KnightFox
KnightFox

Reputation: 3252

MetadataReference.CreateFromAssembly is obsolete

You should use CreateFromFile instead

       references: new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) }

Upvotes: 9

kavics
kavics

Reputation: 433

Sorry, found the answer in the source code:

references: new[] { MetadataReference.CreateFromAssembly(typeof(object).Assembly) }

Upvotes: 12

Related Questions