小编kav*_*ics的帖子

MetadataFileReference无法访问

我最近将我的项目更新到Roslyn 1.0,并且无法在任何地方找到MetadataFileReference类.

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

Error   CS0122  'MetadataFileReference' is inaccessible due to its protection level
Run Code Online (Sandbox Code Playgroud)

我可以用什么呢?

c# roslyn

9
推荐指数
2
解决办法
1841
查看次数

创建新的Microsoft.CodeAnalysis.CustomWorkspace - 得到了ReflectionTypeLoadException

我尝试在.NET Compiler Platform("Roslyn")Samples中创建类似ConsoleClassifier的东西.(Microsoft.CodeAnalysis v0.7 ......)此时我得到了ReflectionTypeLoadException:

CustomWorkspace workspace = new CustomWorkspace();

ReflectionTypeLoadException
{"Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."}
LoaderExceptions: FileNotFoundException
{"Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. A rendszer nem találja a megadott fájlt.":"Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

堆栈跟踪:

at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at …
Run Code Online (Sandbox Code Playgroud)

c# roslyn

6
推荐指数
1
解决办法
1293
查看次数

标签 统计

c# ×2

roslyn ×2