无法加载文件或程序集'System.Runtime,版本= 4.2.1.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'

编程入门 行业动态 更新时间:2024-10-13 06:20:50
本文介绍了无法加载文件或程序集'System.Runtime,版本= 4.2.1.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我从同事那里得到了项目,并且在构建项目时遇到了这个错误:

I got the project from colleague and got this error when building project:

无法加载文件或程序集'System.Runtime,版本= 4.2.1.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.该系统找不到指定的文件.

Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

我猜该dll位于.NET Framework Dll文件夹中: C:\ Program Files(x86)\ Reference Assemblies \ Microsoft \ Framework \ .NETFramework ,但是在搜索后,我发现许多dll其他版本,但我找不到任何 System.Runtime.dll 是 4.2.1.0 .

I guess this dll is in .NET Framework Dll Folder: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework, but after searching, I find many dll of other version, but I didn't find any System.Runtime.dll is 4.2.1.0.

这是另一个类似问题,但没有答案.

Here's another similar question but no answer to it.

.NET Framework中确实存在 System.Runtime.dll 4.2.1.0 吗?

Is System.Runtime.dll 4.2.1.0 really exists in .NET Framework?

推荐答案

我知道这是一篇过时的文章,但我认为与遇到此确切问题的其他人分享我的解决方案很有用.

I know this is an old post, but I think it's useful to share my solution with others that encounter this exact problem.

  • 我通过终端创建了一个新的控制台应用程序: dotnet新控制台
  • 我在Visual Studio 2019中打开了控制台应用程序的文件夹.
  • 我尝试使用 ctrl + f5
  • 运行代码
  • I created a new Console App via the terminal: dotnet new console
  • I opened the folder of the Console App in Visual Studio 2019.
  • I tried to run the code using ctrl + f5
  • 那是我遇到的时间:无法加载文件或程序集'System.Runtime,Version = 5.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'

    要解决此问题,我不得不在其中打开以 .csproj 结尾的文件,而不是在Visual Studio 2019中打开Console App文件夹,然后执行 ctrl + f5 .之后,它运行平稳.希望这对其他人有帮助.经过长时间的故障排除以找到解决方案.

    To solve it, instead of opening the Console App folder in Visual Studio 2019, I had to open the file inside of it that ended with .csproj and then doing ctrl + f5. After that it ran smoothly. Hope this will help someone else. Been troubleshooting for a long time to find the solution.

    TL; DR :在Visual Studio 2019中打开 .csproj 文件,而不是其所在的项目文件夹.

    TL;DR: open the .csproj file in Visual Studio 2019 instead of the project folder that it resides in.

    更多推荐

    无法加载文件或程序集'System.Runtime,版本= 4.2.1.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a

    本文发布于:2023-11-15 22:27:04,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1598503.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:区域性   加载   版本   文件   程序

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!