I have recently used NuGet to upgrade Castle Core to 5.0.0 and Castle Windsor to 5.1.1 in my existing ASP.NET Web Project. Castle Windsor was working perfectly before the upgrade.

Now whenever I call:

...
 var container = new WindsorContainer();
...

I get the error:

...
    System.TypeLoadException
      HResult=0x80131522
      Message=Could not load type 'Castle.Core.Internal.PermissionUtil' from assembly 'Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
      Source=Castle.Windsor
      StackTrace:
       at Castle.MicroKernel.DefaultKernel..ctor(IDependencyResolver resolver, IProxyFactory proxyFactory)
       at Castle.MicroKernel.DefaultKernel..ctor()
       at Castle.Windsor.WindsorContainer..ctor()
       at CastleTest2.Controllers.HomeController.Index() in C:\Users\jacki754\source\repos\CastleTest2\Controllers\HomeController.cs:line 14
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] 

       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()
    ...

I can't find any specific documentation on these new versions, so does anyone know if there are any additional steps that need to be taken (e.g. in Web.Config) to set up Castle Windsor?

1

There are 1 best solutions below

1
Neil On

According to this page https://groups.google.com/g/castle-project-devel/c/M94Lwdzx62I Castle Windsor is not compatible with anything over version 4.4.1 of Castle Core.

If you upgrade Castle Windsor to 5.1.2 (or greater) and leave Castle Core at 4.4.1, then it should work.