
Build a Custom Tool #47
Chapter 6, Speed Hacks
|
185
HACK
After choosing what language type to add your custom tool to, the next step
is to create a new key under that value. This key should be named the same
as your custom tool and will need to include three values; these values are
shown in Table 6-3.
Figure 6-4 shows the registry keys and values for this example custom tool.
Running the Tool
Now your custom tool should be ready to use. Inside Visual Studio, you can
create a file and specify that it should be handled by your custom tool in the
Properties window, as shown in Figure 6-5.
Whenever this file is saved, the custom tool will be run and your code will
be generated. You can view this generated code by clicking the Show All
Files button in the Solution Explorer. You will then see a plus sign next to
your file, and when you click that plus sign, you will see the generated file as
shown in Figure 6-6.
Table 6-2. Language GUIDs
GUID Language
{164B10B9-B200-11D0-8C61-00A0C91E29D5} VB.NET
{E6FDF8B0-F3D1-11D4-8576-0002A516ECE8} J#
{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC} C#
Table 6-3. Custom tool key values
Name Type Description
(Default) REG_SZ (String) A description of your custom tool
CLSID REG_SZ (String) The GUID for your custom tool (as
defined in the
Guid attribute)
GeneratesDesignTimeSource REG_DWORD (DWORD) Specifies whether your custom
tool creates a new file: 1 = True,
0 = False
Figure 6-4. Custom ...