Castle.ActiveRecord.dll not compatible with ASP.NET MVC 4 Web API
-
03-12-2019 - |
Question
MSFT claims that .NET 4.5 is backwards compatible with .NET 4. I went ahead and installed .NET 4.5 and VS 11, then created a new ASP.NET MVC 4 Web API project. When I reference the Castle.ActiveRecord.dll (version 3.0.0.0) into my Web API project, every controller action then generates this error:
[FileNotFoundException: Could not load file or assembly 'Lucene.Net, Version=2.3.1.3, Culture=neutral, PublicKeyToken=45b1dda587cdc860' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +49
System.Web.Http.Dispatcher.HttpControllerTypeCacheUtil.FilterTypesInAssemblies(IBuildManager buildManager, Predicate`1 predicate) +210
System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache() +119
System.Web.Http.Dispatcher.HttpControllerTypeCache..ctor(HttpConfiguration configuration) +69
System.Web.Http.Services.DefaultServiceResolver.<.ctor>b__0(HttpConfiguration config) +241
System.Web.Http.Services.DefaultServiceResolver.GetService(Type t) +80
System.Web.Http.DependencyResolverExtensions.GetService(DependencyResolver resolver) +201
System.Web.Http.DependencyResolverExtensions.GetServiceOrThrow(DependencyResolver resolver) +60
System.Web.Http.Dispatcher.HttpControllerDispatcher..ctor(HttpConfiguration configuration) +65
System.Web.Http.GlobalConfiguration.<.cctor>b__1() +64
System.Lazy`1.CreateValue() +13589652
System.Lazy`1.LazyInitValue() +476
System.Web.Http.WebHost.HttpControllerHandler.<.cctor>b__b() +53
System.Lazy`1.CreateValue() +455
System.Lazy`1.get_Value() +13590694
System.Web.Http.WebHost.HttpControllerHandler.BeginProcessRequest(HttpContextBase httpContextBase, AsyncCallback callback, Object state) +224
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +444
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +354
This is interesting because from what I read. the version 2.3.1.3 is a Lucene (java) version, not a Lucene.Net version. I checked NuGet just to be sure, and it has no version 2.3.1.3 available for Lucene.Net.
What gives? I'd love to get running with the new ASP.NET MVC 4 Web API project, as it blends what I love about ASP.NET MVC and WCF Web API. Any ideas as to how to get around this issue?
Solution
I posted the solution on asp.net forums where the question originated.