I'm building aspnet core app. I wanted to keep one of my MVC Controllers in Class Library (so outside main project).
In order to do that, I've created new class extending Controller in Class Library project called "DataSync". Then, I referenced it in Startup.cs
file of main project:
services.AddMvc().AddApplicationPart(Assembly.Load(new AssemblyName("DataSync")));
Here is the error that I see when I try to open main project in browser:
TypeLoadException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IHttpResponseStreamWriterFactory' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Where should I look for possible problems? What could go wrong here?
To fix that, I updated versions of libraries that where used by both projects (main project and class library) and ensured that versions are exactly the same. After that, the problem seem to disappear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With