-
Notifications
You must be signed in to change notification settings - Fork 127
Debugging NuKeeper
You should be able to run NuKeeper from source code on the command line using dotnet
.
e.g. I have the code checked out at C:\Code\NuKeeper
. I do
cd C:\Code\NuKeeper\NuKeeper
dotnet run inspect
This is the same as nukeeper inspect C:\Code\NuKeeper\NuKeeper
- it runs, the "inspect" command is given to the code, and the current folder is the default target.
When debugging, you often want detailed log verbosity from NuKeeper. However dotnet run inspect -v d
does not do what you want - it produces an enormous amount of build output. dotnet
is made verbose, not NuKeeper. What you want is dotnet run -- inspect -v d
.
With dotnet run inspect -v d
, you are running dotnet
and it gets first look at the command-line. dotnet
understands -v d
, in fact the NuKeeper option syntax is patterned after it, and so dotnet
consumes this option, and does not pass it to NuKeeper
.
The answer is to insert --
as a separator before the options that must go to the program that dotnet
is runnng. Often we start commandlines with dotnet run --
just to be clear, rather than thinking about if dotnet
will consume a particular option or not.
This works for any options. e.g. dotnet run --help
will give you help about dotnet run
, and dotnet run -- --help
will run the NuKeeper code and produce help output from it.
See the dotnet run
documentation for more.
You can also debug in the IDE. In Visual Studio:
- Set the
NuKeeper
project as the startup project by right-clicking and selecting "Set as StartUp project". - Add command-line arguments for the run:
- Open the project properties: Right-click
NuKeeper
again, select "Properties" on the menu. - Select the "Debug" tab of the project properties, and enter the "application arguments", e.g.
inspect -v d
. In this case, you might need a souce control token in the "application arguments" or environmanr vars.
- Open the project properties: Right-click
- Now you can set breakpoints and run to them.