TypeLoadException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.ITypeActivatorCache' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0

Pavan Kumar 1 Reputation point
2023-01-02T15:32:59.977+00:00

I am upgrading my current project from .NET Core 3.1 to .NET 6.0. After upgrade of project along with its dependencies, I am getting below error. I have tried to investigate but no luck.

Please help.

This project uses

275491-image.png

Thanks,
Pavan.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,622 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Michael Taylor 54,901 Reputation points
    2023-01-02T16:43:53.387+00:00

    Are you using SimpleInjector by chance? It sounds like you have a dependency on a package that references an older version of the MVC libraries and that older version is getting pulled in instead of the current version. Firstly ensure all your packages are updated. Then check the output directory for your app and ensure the version of the MVC assembly is 6.0.


  2. Pavan Kumar 1 Reputation point
    2023-01-05T15:32:01.867+00:00

    I have understood by Castle.Windsor documentation, it does not support .Net 6.0, will you suggest any DI framework alternative to Castle.Windsor that supports .NET 6.0 and upgradable on future releases for .NET?


  3. Pavan Kumar 1 Reputation point
    2023-01-12T08:49:10.8066667+00:00

    Thanks a lot for your response, I was able to replace the Castle with built in DI of .NET 6.0. Appreciate your help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.