2014-08-28 7 views
5

Provo a creare qualcosa come ConsoleClassifier in .NET Compiler Platform ("Roslyn") Esempi. (Microsoft.CodeAnalysis v0.7 ...) A questo punto ho un ReflectionTypeLoadException:Creazione di nuovo Microsoft.CodeAnalysis.CustomWorkspace - ottenuto 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"} 

Cosa mi sono perso?

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() 

risposta

5

È necessario installare il VS "14" Build pacchetto Strumenti. Lo puoi trovare nella ISO here.

+0

Non suppongo che aggiungere un riferimento a 'Microsoft.Net.ToolsetCompilers' lo farebbe invece? Mi piacerebbe poter provare questo in VS2013. (Oppure il pacchetto di strumenti di compilazione è separato dalla VS stessa? Confused, di Tilehurst ...) –

+0

No, il pacchetto toolset consente di utilizzare una versione specifica dei compilatori Roslyn al posto di quelli installati di sistema. In questo caso, tuttavia, Roslyn fa riferimento a MSBuild. Presto, tuttavia, questo verrà preso in considerazione in un altro assembly e la maggior parte del materiale Workspace sarà un PCL. –

+0

Grande, grazie - ho installato CTP4 sul mio Surface per il momento :) –