我毫不费力地将我的 MVC3 项目升级到 MVC4,但是 Web API(我这样做的原因)不起作用,因为显然有一些东西引用了 NHibernate。
<Exception>
<ExceptionType>System.IO.FileNotFoundException</ExceptionType>
<Message>Could not load file or assembly 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The system cannot find the file specified.</Message>
<StackTrace>
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at System.Web.Http.Dispatcher.DefaultHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver assembliesResolver)
at System.Web.Http.WebHost.WebHostHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver assembliesResolver)
at System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache()
at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache()
at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.SelectController(HttpRequestMessage request)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
</StackTrace>
</Exception>
我删除了对 NHibernate 的引用,因为我尝试将 FunnelWeb 博客添加到我的站点,但我最终在同一个项目中得到了两种完全不同的做法,我一点也不喜欢那样。
而且我认为将 NHibernate 库重新放置到位不是一个好主意,因为我会隐藏一些我应该知道的东西。
我试过 NDepend,但没有找到 NHibernate。
请注意,我的项目正在编译和运行良好。请问有什么想法吗?