正在创建新的Microsoft.CodeAnalysis.CustomWorkspace-得到ReflectionTyp
本文关键字:CodeAnalysis CustomWorkspace- 得到 ReflectionTyp Microsoft 创建 | 更新日期: 2023-09-27 18:20:00
我试图在.NET编译器平台("Roslyn")示例中创建类似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"}
我错过了什么?
Stacktrace:
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 System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore[T,TMetadataView](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports[T,TMetadataView](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports[T,TMetadataView]()
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.<GetExports>b__6[TExtension,TMetadata](ExportKey _)
at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue](ImmutableDictionary`2& location, TKey key, Func`2 valueFactory)
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.GetExports[TExtension,TMetadata]()
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefWorkspaceServices..ctor(MefHostServices host, Workspace workspace)
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.CreateWorkspaceServices(Workspace workspace)
at Microsoft.CodeAnalysis.Workspace..ctor(HostServices host, String workspaceKind)
at Microsoft.CodeAnalysis.CustomWorkspace..ctor(HostServices host, String workspaceKind)
at Microsoft.CodeAnalysis.CustomWorkspace..ctor()
您需要安装VS"14"Build Tools包。你可以在这里的ISO中找到它。