简体   繁体   English

为什么调试在 Visual Studio 上不起作用?

[英]Why is debug not working on Visual Studio?

I'm just a begginer with C#, I wanted to start to code but when I try to debug my code, the debug part is not avaiable to be used, I'm not sure what's wrong with the app or if it's a problem with my computer, which runs Windows 11我只是 C# 的初学者,我想开始编写代码,但是当我尝试调试我的代码时,无法使用调试部分,我不确定应用程序有什么问题或者它是否有问题我的电脑,运行 Windows 11

Hope you can help me out.希望你能帮帮我。

Thanks in advance.提前致谢。这是问题所在

I tried to uninstall visual studio several times, also watched some videos related to it but it was a complete waste of time.我试过几次卸载visual studio,也看了一些相关的视频,但这完全是浪费时间。

I can reproduce your situation:我可以重现你的情况:

在此处输入图像描述

This issue comes from your code is not be recognized as Project/Solution.此问题来自您的代码未被识别为项目/解决方案。

C# is different from the language like python, open the script file directly will not make it be able to debug/run. C#与python等语言不同,直接打开脚本文件是无法调试/运行的。

So the solution is creating a minimal structure.所以解决方案是创建一个最小的结构。

You can follow the below steps to start a demo C# code.您可以按照以下步骤开始演示 C# 代码。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

After the above steps, you will be able to debug the C# code:经过以上步骤,您将可以调试 C# 代码:

在此处输入图像描述

Check to see if you are running in debug mode or release mode.检查您是否在调试模式或发布模式下运行。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM