4
votes

I am building a Custom Tool code generator using the Visual Studio SDK and basing it on the SingleFileGenerator example.

My question is how to enter debug mode on this code? I can currently add my custom tool to a file in Visual Studio but it errors out, I'd like to be able to debug this code if possible.

2

2 Answers

5
votes

You need to debug Visual Studio, you can either do it by attaching to a running session (Tools\Attach To Process) or by setting Visual Studio (devenv.exe) to be your startup project of the Custom Tool Project.

3
votes

Let me try and elaborate Jeff's answer:

  1. Open the custom tool project (AKA: proj1)
  2. Open a test project (aka: proj2) and define the file's custom tool to point to the wanted custom tool.
  3. in proj1: create a break point and attach to process of p2.
  4. in proj2: save the file and the break point will spring in p1 allowing you to debug.

Hope it helps.