Integrate FormatCode Into Visual Studio .NET


Format Source Code within Visual Studio .NET

The following instructions allow you to format source code file in Visual Studio .NET using FormatCode command line tool. We used Visual Studio .NET version 2005, so if you use an older or even a newer version then several screenshots or menu items may differ from our description.


Add a tool action that will invoke FormatCode within Visual Studio .NET

1. Click "Tools" -> "External Tools".

2. In the "External Tools" dialog box, choose "Add", and enter "FormatCode" for the menu option in the Title box.

3. Type an ampersand before one of the letters in the tool name to create an accelerator key for the command when it appears on the Tools menu. For example, if you use "&FormatCode", the letter 'x' will be the accelerator key.

4. In the "Command" box, enter the path to FormatCode.exe, or choose Browse to navigate to it.

5. Fill in the form as show below: (Assuming you installed FormatCode in C:\Program Files\FormatCode\)

  • Title:                    &FormatCode
  • Command:           C:\Program Files\FormatCode\FormatCode.exe
  • Arguments:          $(ItemPath)
  • Initial directory:    $(TargetDir)

6. Click "OK" to save settings.


Add a keymapping so you can invoke FormatCode using Ctrl+Alt+T

1. On the "Tools" menu, choose "Options".

2. Choose "Keyboard" from the "Environment" page.

3. In the "Show commands containing" list, type "Tools".

4. In the "Command names" list, scroll to the "External Command 1" entry.

5. Place the cursor in the "Press shortcut keys" text box, and then press Ctrl+Alt+T to assign it to FormatCode.

6. Choose "Add", then click "OK" to save settings.


You may now invoke FormatCode command line tool two ways:

1. Using Ctrl+Alt+T.

2. By clicking "Tools" -> "FormatCode".


With FormatCode Code Formatters, you can format and transform any foreign source code to meet your favourite coding style within Visual Studio .NET in several seconds!


Products

C/C++ Formatter

Java Formatter

C# Formatter

VB Formatter

VB.NET Formatter

PHP Formatter

ASP Formatter

VBScript Formatter

JavaScript Formatter

Delphi Formatter

Asm x86 Formatter

Asm 51 Formatter

Download

Purchase