【发布时间】:2021-01-05 16:59:47
【问题描述】:
我正在尝试使用 dotnet run:dotnet run -p /Users/user/Pictures 将命令行参数 -p 传递给我的 .NET Core 应用程序。但是,当我这样做时,我会收到如下所示的错误消息。看起来dotnet run 正在尝试打开一个项目文件夹,而不是将此参数传递给我的应用程序。我可以将其他内容(例如 -q)传递给我的应用程序。
使用dotnet run时如何将-p传递给我的应用程序?
错误是这样的:
$ dotnet run -p /Users/user/Pictures
MSBUILD : error MSB1001: Unknown switch.
Switch: /Users/user/Pictures
For switch syntax, type "MSBuild -help"
The build failed. Fix the build errors and run again.
我正在尝试使用这样的开关编写一个 .NET 应用程序:
Usage: du [-s] [-p] [-b] "path"
Summarize disk usage of the set of FILES, recursively for directories.
You MUST specify one of the parameters, -s, -p, or -b
-s Run in single threaded mode
-p Run in parallel mode (uses all available processors)
-b Run in both parallel and single threaded mode.Runs parallel followed by sequential mode
【问题讨论】:
-
听起来像是错字。你到底想运行什么命令?
-
更新了命令和它的作用。这不是错字。我正在尝试在 Jetbrains Rider Terminal 中运行它。
-
不清楚你想在这里做什么。
-p是dotnet run参数,也是du参数?要将/Users/user/Pictures传递给dotnet run还是传递给正在运行的应用程序?