Visual Studio ASP.Net 当目标平台设置为 x64 而不是 Any 时应用程序无法启动 Cpu

Visual Studio ASP.Net Application not starting when Target Platform is set to x64 instead of Any Cpu

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

将应用程序本身的平台目标设置为“Any 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 版本似乎是正确的,我可以手动启动 x64 编译的应用程序(通过调用 dotnet application-name.dll)没有问题。

我已经为此苦苦挣扎了三天,但离解决方案还差一英寸。 在启动应用程序时,see/set Visual Studio 正在使用的命令会很有帮助,但我不知道该怎么做。

问题已解决。

我必须手动添加

"commandLineArgs": "run"

至launchSettings.json。