首页 > 解决方案 > 当目标平台设置为 x64 而不是任何 Cpu 时,Visual Studio ASP.Net 应用程序未启动

问题描述

我有一个 .Net 5.0/Angular SPA(尽管问题在将目标框架设置为 .NET Core 3.1 时完全相同),所有依赖的程序集项目都设置为目标 x64。

将应用程序本身的平台目标设置为“任何 CPU”并从 Visual Studio 开始调试时,一切都按预期启动和工作。但是,当将应用程序的平台目标设置为“x64”时,我从 WebServer 得到的输出是:

Usage: dotnet [options]
Usage: dotnet [path-to-application]
Options:
  -h|--help         Display help.
  --info            Display .NET information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.
path-to-application:
  The path to an application .dll file to execute.

就好像在没有任何参数的情况下调用了 dotnet 命令行工具。

Visual Studio 使用的 dotnet 版本似乎是正确的,我可以手动(通过调用dotnet application-name.dll)启动 x64 编译的应用程序而不会出现问题。

我已经为此奋斗了三天,但距离解决方案还差一英寸。在启动应用程序时查看/设置 Visual Studio 正在使用的命令会很有帮助,但我不知道如何执行此操作。

标签: .netvisual-studiovisual-studio-debugging

解决方案


问题解决了。

我必须手动添加

"commandLineArgs": "run"

启动Settings.json。


推荐阅读