C# 调试未启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9374530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 07:05:20  来源:igfitidea点击:

Debugging doesn't start

c#visual-studio-2010debuggingbuild.net-2.0

提问by Saint

When I hit F5 (debugging mode) nothing happens. Building works correctly, exe file I can launch properly, but can't start debug. Why?

当我按下 F5(调试模式)时,什么也没有发生。构建工作正常,exe 文件我可以正常启动,但无法启动调试。为什么?

回答by Sudik Maharana

Restart VS and try to debug. Some time it happens, even I also had the same problem.

重启VS并尝试调试。有一段时间它发生了,甚至我也遇到了同样的问题。

回答by David Anderson

First, in your project properties and in the Debugtab, make sure that your Start Actionis set to Start Projectand not some other option that won't run. If that doesn't resolve it then:

首先,在您的项目属性和Debug选项卡中,确保您Start Action的设置为Start Project而不是其他一些不会运行的选项。如果这不能解决它,那么:

Go to Tools -> Options -> Environment -> Keyboardand in Show commands containing:type Debug.Startand make sure that Shortcuts for selected command:is set to F5 (Global). Also make sure you do not have anything else mapped to F5 that might conflict.

转到Tools -> Options -> Environment -> KeyboardShow commands containing:输入Debug.Start并确保将Shortcuts for selected command:其设置为F5 (Global)。还要确保您没有其他任何可能冲突的映射到 F5 的内容。

Finally if this doesn't resolve your issue, then I suggest that you export your current environment settings as a backup, and then reset all environment settings completely. See if that resolves it, if it does not then reimport your old settings and try repairing visual studio.

最后,如果这不能解决您的问题,那么我建议您将当前的环境设置导出为备份,然后完全重置所有环境设置。看看是否解决了它,如果它没有重新导入您的旧设置并尝试修复visual studio。

回答by Saint

I finally created other project and copied existing files and folders to it. Maybe 'unprofessional' but it's working :) Fortunately this is small project

我最终创建了其他项目并将现有文件和文件夹复制到其中。也许“不专业”,但它的工作:) 幸运的是,这是一个小项目

回答by bresleveloper

I had the same problem and all the tricks didnt do it until I unchecked the "Enable the Visual Studio hosting process" under the debug tab in the project properties

我遇到了同样的问题,所有的技巧都没有做到,直到我取消选中项目属性中调试选项卡下的“启用 Visual Studio 托管进程”

回答by mo.

Ugh! I was experiencing the exact same symptoms you were, and after trying all the suggestions, the only one that worked was your own: creating a new project and copying all the contents across.

啊! 我遇到了与您完全相同的症状,在尝试了所有建议之后,唯一有效的是您自己的建议:创建一个新项目并复制所有内容。

Then I noticed that I couldn't manually delete my Bin directory, and I realised that MyApp.vshost.exe had been running in the background this whole time, preventing itself from being overwritten by Visual Studio 2012. Not sure how it still worked from VS2010 though :/

然后我注意到我无法手动删除我的 Bin 目录,我意识到 MyApp.vshost.exe 一直在后台运行,防止自己被 Visual Studio 2012 覆盖。不知道它是如何工作的VS2010虽然:/

In summary, the solution that worked for me: Kill the process, try again.

总之,对我有用的解决方案:终止进程,再试一次。

In other words, have you tried turning it off and on again?

换句话说,你有没有试过把它关掉再打开?

回答by toregua

I have found a solution:

我找到了一个解决方案:

  1. Close your Visual studio solution
  2. Open your .csprojproject header with notepad ++ for example.
  3. Search for <UseIISExpress>false</UseIISExpress>in the <PropertyGroup>section
  4. Change the value to true : <UseIISExpress>true</UseIISExpress>
  5. Save
  6. Open your solution and for me now debug works on my project
  1. 关闭您的 Visual Studio 解决方案
  2. .csproj例如,使用记事本 ++打开您的项目标题。
  3. <UseIISExpress>false</UseIISExpress><PropertyGroup>栏目中搜索
  4. 将值更改为 true : <UseIISExpress>true</UseIISExpress>
  5. 节省
  6. 打开您的解决方案,现在对我来说调试在我的项目上工作

回答by user2020952

I'm experiencing the same problem. I haven't been able to display the debug window, but I was able to redirect the debug output to the simplified 'immediate window' by checking the corresponding option in Debug->Options and Settings; only shows explicit Debug writes in the code like Debug.Writeline().

我遇到了同样的问题。我一直无法显示调试窗口,但我可以通过检查调试->选项和设置中的相应选项将调试输出重定向到简化的“立即窗口”;仅在代码中显示显式调试写入,如 Debug.Writeline()。

Visual Studio 2010

视觉工作室 2010

回答by dan richardson

Sorry to bring up an old question but I had the same problem today, but the reason was actually because of the build order of the solution. If you go into the Solution Property Pages-> Common Properties-> Startup Project.
The ensuring Multiple startup projectsis selected, move the web project to the top of the list.

很抱歉提出一个老问题,但我今天遇到了同样的问题,但原因实际上是因为解决方案的构建顺序。如果你进入Solution Property Pages-> Common Properties-> Startup Project。选择了
确保Multiple startup projects,将 web 项目移动到列表的顶部。

In my web application solution I have 2 web projects and 5 code projects, one of my code projects was at the top, and as such debug would not start.

在我的 Web 应用程序解决方案中,我有 2 个 Web 项目和 5 个代码项目,其中一个代码项目位于顶部,因此调试不会启动。

Hope others find this helpful

希望其他人觉得这有帮助

回答by Nour Sabouny

I have very funny solution, but it worked for me,

我有非常有趣的解决方案,但它对我有用,

Hold the F5 key until you see that the debugging started, I'm serious guys.

按住 F5 键直到你看到调试开始,我是认真的人。

回答by user2189123

close your project then delete all files on yourproject\bin\Debug\ folder to make new debug solution

关闭您的项目,然后删除 yourproject\bin\Debug\ 文件夹中的所有文件以制作新的调试解决方案