如何在 .csproj 的 StartProgram 设置中指定命令行参数? [英] How do you specify command line arguments in a .csproj's StartProgram setting?
问题描述
我正在尝试在
值的
中为可执行文件指定命令行参数 目前看起来像这样
I'm trying to specify command line arguments to an executable in a <StartProgram>
value of a <PropertyGroup>
Currently looks like this
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(SolutionDir)\Edge.Express\node.exe</StartProgram>
</PropertyGroup>
我正在尝试自动化将我的库附加到正在运行的进程所涉及的步骤,以便我的团队可以直接调试库而无需额外的仪式(他们还不熟悉 Visual Studio)
I'm trying to automate the steps involved in attaching my library to a running process so my team can directly debug a library without additional ceremony (They're not familiar with Visual Studio yet)
我将节点可执行文件复制到 Edge.Express 文件夹中,我的 Express 服务器配置位于该位置的 server.js 中.我想要做的是:
I copied the node executable to the Edge.Express folder and my Express server configuration is in server.js at that location. What I want to do is this:
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(SolutionDir)\Edge.Express\node.exe server</StartProgram>
</PropertyGroup>
但这会引发以下异常
删除服务器"参数会启动一个节点实例.
Removing the "server" arg fires up an instance of node.
如何在我的
设置中为 node.exe 提供服务器"参数?
How would I give the "server" argument to node.exe inside my <StartProgram>
setting?
或者有没有办法将 StartAction 设置为运行批处理脚本并将服务器启动推送到脚本中?
Alternatively Is there a way to set the StartAction to run a batch script and just push the server startup into the script?
快速搜索没有返回关于可用 StartActions 是什么的任何文档
A quick search did not return any documentation on what the available StartActions are
推荐答案
As Hans 指出:如果你想为
Program 指定参数,你必须使用
元素:
As Hans pointed out: If you want to specify arguments for the <StartAction>
Program, you have to use the <StartArguments>
element:
<StartAction>Program</StartAction>
<StartProgram>$(SolutionDir)\Edge.Express\node.exe</StartProgram>
<StartArguments>server</StartArguments>
这篇关于如何在 .csproj 的 StartProgram 设置中指定命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!