Cannot load file or assembly System.Runtime
Solution 1
I resolved the issue myself. I recreated both projects, targeting .NET 4.7, and the issue was resolved.
Maybe the problem was that I originally targeted an earlier version of .NET and then changed the version. But I am not sure.
Solution 2
I have face same issue, My issue is
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
To Solve this issue, Comment assembly <dependentAssembly></dependentAssembly>
which Contain culture="neutral"
in Web.config File and Rebuild Application. My application run properly and Problem Solve.
Solution 3
I had faced the same issue. Just follow these steps to solve your problem
- Right Click on your solution and choose
Manage NuGet Packages for Solution
- In the
Installed
tab searchSystem.Runtime
- Now you can see in which projects you have installed the library
- Select proper projects and downgrade
System.Runtime
to the previous version and upgrade it again - Clean & Rebuild your solution
- Run project
It should works now.
Solution 4
For anyone in the future.
You can also try deleting your temporary ASP.NET Files, look for this folder:
C:\Windows\Microsoft.NET\Framework[yourversionNumber]\Temporary ASP.NET Files
Also, try this one
C:\Users[YourUser]\AppData\Local\Temp\Temporary ASP.NET Files
Related videos on Youtube
g.arbia777
Updated on June 04, 2022Comments
-
g.arbia777 almost 2 years
I have two projects in one solution. One is a class library that has three nuget packages installed: HtmlAgilityPack, Microsoft.Syndication, and IrcDotNet. The other is the startup project, a console application project with only one Nuget Package installed, Microsoft.Syndication. This project also has a dependency on the class library. When I run the startup project, I get an exception with the following details.
System.IO.FileNotFoundException occurred HResult=0x80070002 Message=Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source= StackTrace: at AlexiConsole.Program.Main(String[] args) in c:\Users\myself\documents\visual studio 2017\Projects\Alexi\AlexiConsole\Program.cs:line 21Inner Exception 1: FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I don't know why. I already have binding redirects in the app.config of both projects for redirecting versions 0.0.0.0-4.1.0.0 to 4.1.0.0.
Both project target .NET 4.7.
-
Leo Liu over 6 yearsthanks for sharing your solution here, you could mark it as the answer, so it could help other community members who get the same issues.