简体   繁体   English

调试时VS错误

[英]VS error when debugging

I'm writing a C# winform application.我正在编写一个 C# winform 应用程序。 All went well but suddenly debug won't work.一切顺利,但突然调试不起作用。 I get this error message:我收到此错误消息:

Error while trying to to run project: Unable to start program [here follows the path of the executable] Input or output cannot be redirected because the specified file is invalid.尝试运行项目时出错:无法启动程序 [此处遵循可执行文件的路径] 由于指定的文件无效,无法重定向输入或输出。

Here's the .sln file这是 .sln 文件

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stub", "Stub\Stub.csproj", "{C6376D67-EEEC-4AEE-B779-D743D0181636}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {C6376D67-EEEC-4AEE-B779-D743D0181636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {C6376D67-EEEC-4AEE-B779-D743D0181636}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {C6376D67-EEEC-4AEE-B779-D743D0181636}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {C6376D67-EEEC-4AEE-B779-D743D0181636}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

I compared the project's properties with the project's properties of a dummy project and found that in my project under the debug tab in field Command line options this value:我将项目的属性与虚拟项目的项目属性进行了比较,发现在我的项目中,在命令行选项字段中的调试选项卡下有这个值:

No Command-line没有命令行

No idea where this came from, but after removing it, debugging works again.不知道这是从哪里来的,但在删除它后,调试再次工作。

Check your project's properties to contain a field Command line options .检查项目的属性以包含一个字段Command line options If it contains No Command-line then remove it.如果它包含No Command-line则将其删除。

可能与原始问题无关,但在 VS Code 上,如果在调试器中启动 .NET Core 应用程序时,launch.json 中的参数中有“<”,则可能会发生这种情况:

args: ["<something>"]

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

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