无法加载文件或程序集 System.Runtime [英] Cannot load file or assembly System.Runtime

查看:745
本文介绍了无法加载文件或程序集 System.Runtime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个解决方案中有两个项目.一个是安装了三个 nuget 包的类库:HtmlAgilityPack、Microsoft.Syndication 和 IrcDotNet.另一个是启动项目,一个控制台应用项目,只安装了一个 Nuget Package,Microsoft.Syndication.该项目还依赖于类库.当我运行启动项目时,我收到以下详细信息的异常.

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 HResult=0x80070002 消息=无法加载文件或程序集System.Runtime,版本=4.1.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a' 或它的依赖项之一.系统找不到指定的文件.
源 = StackTrace:在AlexiConsole.Program.Main(String[] args) 在c:\用户\我自己\文档\视觉工作室2017\Projects\Alexi\AlexiConsole\Program.cs:line 21

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 21

内部异常 1:FileNotFoundException:无法加载文件或程序集'System.Runtime,版本=4.0.20.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一.这系统找不到指定的文件.

Inner 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.

我不知道为什么.我已经在两个项目的 app.config 中绑定重定向,用于将版本 0.0.0.0-4.1.0.0 重定向到 4.1.0.0.

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.

两个项目都面向 .NET 4.7.

Both project target .NET 4.7.

推荐答案

我自己解决了这个问题.我针对 .NET 4.7 重新创建了这两个项目,问题得到解决.

I resolved the issue myself. I recreated both projects, targeting .NET 4.7, and the issue was resolved.

也许问题在于我最初针对的是 .NET 的早期版本,然后更改了版本.但我不确定.

Maybe the problem was that I originally targeted an earlier version of .NET and then changed the version. But I am not sure.

这篇关于无法加载文件或程序集 System.Runtime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆