简体   繁体   English

未知模块中发生类型为“System.IO.FileNotFoundException”的未处理异常“

[英]An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module"

I'm developing a C# application and I get the following error at debug runtime:我正在开发一个 C# 应用程序,在调试运行时出现以下错误:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.未知模块中发生类型为“System.IO.FileNotFoundException”的未处理异常。 Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.无法加载文件或程序集“System.Runtime,Version=5.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。 The system cannot find the file specified.该系统找不到指定的文件。

And the application goes to the break mode.然后应用程序进入中断模式。

I'm new in C# and .NET world.我是 C# 和 .NET 世界的新人。 I'm using the Visual Studio for debugging.我正在使用 Visual Studio 进行调试。

I had this exact error message earlier.我之前收到了这个确切的错误消息。 I do not know if our situations are the same, but hopefully, they are, and this fix works for you as well.我不知道我们的情况是否相同,但希望它们是相同的,并且此修复程序也适用于您。

So I am also new to c#, and especially visual studio.所以我也是 c# 的新手,尤其是 Visual Studio。 So, when I opened my project, I would launch visual studio, click open folder, and open the folder my application was in. But alas, I did not know that in fact to open it, you open up the folder in explorer, and double click on the.sln file.所以,当我打开我的项目时,我会启动visual studio,点击打开文件夹,然后打开我的应用程序所在的文件夹。但是,我不知道实际上要打开它,你在资源管理器中打开文件夹,然后双击.sln 文件。 If you do that, when you build and/or debug the application, you will not get that error.如果您这样做,当您构建和/或调试应用程序时,您将不会收到该错误。 Or at least if your circumstances are the same as mine.或者至少如果你的情况和我一样的话。

May I ask, when you open it up, how do you do so?请问,当你打开它时,你是怎么做到的? If it is any other way then searching for the.sln in file explorer and double clicking on it, then that is your problem.如果是其他方式,然后在文件资源管理器中搜索 .sln 并双击它,那就是你的问题。

The most important hint in the error message is that it's trying to load the System.Runtime assembly, which is part of .NET.错误消息中最重要的提示是它正在尝试加载System.Runtime程序集,该程序集是 .NET 的一部分。 The problem has come up before on Stack Overflow: Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Stack Overflow 上曾出现此问题: Visual Studio 2017 - 无法加载文件或程序集“System.Runtime,Version=4.1.0.0”或其依赖项之一

Consider those solutions first.首先考虑这些解决方案。

I am also new in C#, and I had the same msg when I tried to open my app written in VSC in VS2019.我也是 C# 的新手,当我尝试在 VS2019 中打开用 VSC 编写的应用程序时,我收到了相同的消息。 I created this app using dotNet.我使用 dotNet 创建了这个应用程序。 The one possible answer is you can run the app using the Open Developer Command Prompt and you can type dotnet run.一个可能的答案是您可以使用 Open Developer Command Prompt 运行该应用程序,并且您可以键入 dotnet run。 The app will run automatically.该应用程序将自动运行。

This happens when you open the file folder.当您打开文件夹时会发生这种情况。 Open the solution file by double click on the.sln file in the file folder.双击文件夹中的 .sln 文件打开解决方案文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未知模块中出现未处理的“System.IO.FileNotFoundException”类型异常 - An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module mscorlib.dll 中发生类型为“System.IO.FileNotFoundException”的未处理异常 - An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll InAirSignature.exe中发生了类型为'System.IO.FileNotFoundException'的未处理异常 - An unhandled exception of type 'System.IO.FileNotFoundException' occurred in InAirSignature.exe c#中类型为'System.IO.FileNotFoundException'的未处理异常 - An Unhandled exception of type 'System.IO.FileNotFoundException' in c# “System.IO.FileNotFoundException”类型的未处理异常 - Dll & 远程处理 - An unhandled exception of type 'System.IO.FileNotFoundException' - Dll & remoting Azure - 未处理的异常:System.IO.FileNotFoundException - Azure - Unhandled Exception: System.IO.FileNotFoundException C# 使用未知模块中的互操作未处理的“System.IO.FileNotFoundException”加载 Excel 文件 - C# Loading Excel File Using Interop Unhandled 'System.IO.FileNotFoundException' in Unknown Module 类型为“ System.IO.FileNotFoundException”的第一次机会异常发生在System.Net.Http.Formatting.dll中 - A first chance exception of type 'System.IO.FileNotFoundException' occurred in System.Net.Http.Formatting.dll 获取未处理的异常错误:System.IO.FileNotFoundException: - Getting Unhandled exception error: System.IO.FileNotFoundException: mscorlib.ni.dll中发生类型为'System.IO.FileNotFoundException'的第一次机会异常-Windows Phone - A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll - windows phone
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM