.net - 当目标平台设置为 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 正在使用的命令会很有帮助,但我不知道如何执行此操作。
解决方案
问题解决了。
我必须手动添加
"commandLineArgs": "run"
启动Settings.json。
推荐阅读
- python - 计算列表中的集合数
- javascript - 想知道是否有任何方法可以在 JSP 端查看表单值对象
- elasticsearch - Elasticsearch 中的最大记录数
- c++ - 使用“虚拟”对象来促进 C++ 中可接受的 OOP,是否存在更好的替代方案?
- angular - PrimeNG GMap 组件在从变量传递 lat 和 long 时不显示地图
- html - 为什么我的 servlet 映射阻止 CSS/HTML 链接?
- javascript - 添加/删除 css 类有时会破坏 js?
- java - 使用带有 Retrofit 的 OkHttp3 WebSocket 持续跟踪 android 设备的位置
- ruby-on-rails - 我无法让 Trix 编辑器在 Bootstrap 主题中正确显示
- c# - DbSet.Where() 在查询中不返回任何记录,即使它们存在于数据集中