问题
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>
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)
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>
but that throws the following exception
Removing the "server" arg fires up an instance of node.
How would I give the "server" argument to node.exe inside my <StartProgram>
setting?
Alternatively Is there a way to set the StartAction to run a batch script and just push the server startup into the script?
A quick search did not return any documentation on what the available StartActions are
回答1:
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>
来源:https://stackoverflow.com/questions/26492099/how-do-you-specify-command-line-arguments-in-a-csprojs-startprogram-setting