Could not load file or assembly Microsoft.Framework.DependencyInjection.Interfaces
Hi guys,
I'm migrating an application from asp.net 4.5 to the new version of asp.net, but I'm getting the following error when I try to run my project:
Could not load file or assembly 'Microsoft.Framework.DependencyInjection.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Framework.DependencyInjection.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I'm currently using the CLR-x86-1.0.0-beta5. In this version, Microsoft.Framework.DependencyInjection.Interfaces changed to Microsoft.Framework.DependencyInjection.Abstractions. I do have that one in my References.
When I try to search for 'Microsoft.Framework.DependencyInjection.Interfaces' in VS Entire Solution, no results are found.
Does anyone know why I'm getting this error? And how I can resolve it?
Thanks a lot!
Look in your project.lock.json and see what is pulling it in.
I tried, no results found... :(
Can you show your project.json file?
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"DotNetOpenAuth.AspNet": "4.3.4.13329",
"DotNetOpenAuth.Core": "4.3.4.13329",
"DotNetOpenAuth.OAuth.Consumer": "4.3.4.13329",
"DotNetOpenAuth.OAuth.Core": "4.3.4.13329",
"DotNetOpenAuth.OpenId.Core": "4.3.4.13329",
"DotNetOpenAuth.OpenId.RelyingParty": "4.3.4.13329",
"Microsoft.Bcl": "1.1.9",
"Microsoft.Bcl.Build": "1.0.14",
"Microsoft.Net.Http": "2.2.28",
"Newtonsoft.Json": "6.0.5",
"LynkxSystem": "1.0.0-*",
"Dispatcher": "1.0.0-*",
"WebForm": "1.0.0-*",
"SiteCore": "1.0.0-*",
"ScheduledTasks": "1.0.0-*",
"MailingManager": "1.0.0-*",
"Microsoft.AspNet.Hosting": "1.0.0-beta5",
"Microsoft.Owin": "3.0.1",
"BrunelXrmService": "1.0.0",
"EPocalipse.IFilter": "1.0.0",
"SMTP.Net": "3.0.1.8",
"Microsoft.Framework.DependencyInjection": "1.0.0-beta5",
"Microsoft.Framework.DependencyInjection.Abstractions": "1.0.0-beta5"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Data": "4.0.0.0",
"System.Drawing": "4.0.0.0",
"System.Configuration": "4.0.0.0",
"System.IdentityModel": "4.0.0.0",
"System.Net.Http": "4.0.0.0",
"System.ServiceModel": "4.0.0.0",
"System.Net.Http.WebRequest": "4.0.0.0",
"System.Web": "4.0.0.0",
"System.Xml": "4.0.0.0",
"System.Runtime.Serialization": "4.0.0.0"
}
}
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
So you only updated some of your references to beta5 and left some at beta4. Can you show your project.lock.json now? I'm like 90% sure there's a reference to Microsoft.Framework.DependencyInjection.Interfaces in there.
Way too long project.lock.json file
So the reason you're having problems is because you're pulling in both beta4 and beta5 versions. Fix that.
Ah damn it, you are right again! :p Thanks a lot man! I'm looking into so much code these days that I don't notice the little problems anymore!