6

I try to create something like ConsoleClassifier in .NET Compiler Platform ("Roslyn") Samples. (Microsoft.CodeAnalysis v0.7...) At this point I get a 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"}

What did I miss?

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()
kavics
  • 423
  • 8
  • 19

1 Answers1

5

You need to install the VS "14" Build Tools package. You can find it in the ISO here.

Kevin Pilch
  • 11,485
  • 1
  • 39
  • 41
  • I don't suppose adding a reference to `Microsoft.Net.ToolsetCompilers` would do it instead? I'd love to be able to try this within VS2013. (Or is the build tools package separate from VS itself? Confused, of Tilehurst...) – Jon Skeet Oct 06 '14 at 18:19
  • No, the toolset package enables you to use a specific version of the Roslyn compilers instead of the system installed ones. In this case though, Roslyn references MSBuild. Soon though, that will be factored out into a different assembly, and the majority of the Workspace stuff will be a PCL. – Kevin Pilch Oct 06 '14 at 23:05
  • Great, thanks - have installed CTP4 on my Surface for the moment :) – Jon Skeet Oct 07 '14 at 04:18
  • Note that you can install just the Build Tools installer, you don't have to run the full VS install if you want to get unblocked in the meantime. – Kevin Pilch Oct 07 '14 at 04:38