Search code examples
c#asp.net.net-4.0antlrmef

Could not load file or assembly antlr.runtime


I'm using MEF to add some parts to my ASP.net web application. I made a PoC project and everything works like a charm. But when I try to add it to my existing web app, I get the following error:

Could not load file or assembly 'antlr.runtime, Version=2.7.6.2, Culture=neutral, PublicKeyToken=1790ba318ebc5d56' or one of its dependencies. The system cannot find the file specified.

My project does not have any reference to antlr.runtime, and if I remove the MEF code it works fine.

var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new DirectoryCatalog("bin"));
_container = new CompositionContainer(catalog);
var exports = _container.GetExports<HLResourceProviderFactoryBase>();

My DirectoryCatalog object successfully finds the assemblies where I want to get the Parts from.

Any hint on what could be the problem? Thanks in advance


Solution

  • You can use AssemblyInfo tool to see the dependency graph and find out what assembly depends on "antlr.runtime".