Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Debugging NuKeeper

Anthony Steele edited this page Feb 5, 2019 · 11 revisions

NuKeeper Logo

Debugging NuKeeper

Command-line runs

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.

IDE debugging

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.
  • Now you can set breakpoints and run to them.
Clone this wiki locally