Saturday, November 27, 2010

TracExplorer and VS 2010 Integration

TracExplorer and VS 2010 Integration

(Nov 27, 2010)

Introduction

Caveat: I'm new to an issue tracker system.  How I use Trac and TracExplorer, as described here, may not be a good practice, but it worked.
(you can skip the introduction if you already know Trac and TracExplorer well)

Trac is an interesting issue tracking system.  Its default feature set provides what many software developers need.  Trac's plugin architecture also allows us to add more features to the system if we need them.  Therefore, default Trac is useful and relatively simple.  Extended Trac is more powerful, but may be complicated.  Using Trac inside the Visual Studio can also be convenient, provided that the integration provides adequate features and user interfaces.

TracExplorer has a fascinating idea for VS 2005 and 2008 integration.  However, the available binary in source forge does not work with VS 2010.  In addition, TracExplorer (as of version 0.20 beta) is not feature rich.  It is rather inadequate and not improved for months.  For example, TracExplorer does not allow the user to create a new ticket.  A typical web-based user interface is needed.  Yet, it allows us to quickly view and modify tickets.  Many people may be satisfied with the available features.

This integration contains two parts: installatiion of Trac's XML-RPC plugin, which is a requirement of TracExplorer, and VS 2010 integration.

Installation of XML-RPC plugin

  1. Get the plugin by downloading its source package.  Don't worry that you do not get the binary. The actual installation is simple.

  2. Extract the source package to a preferred folder.  Inside the package, we mainly use the source inside the trunk.  Other folders usually contain outdated version provided for compatibility.

  3. Generate an 'egg' package. This step requires Python, but we should already have it installed as Trac's prerequisite.  A default Python's folder from BitNami is "C:\Program Files\BitNami Trac Stack\python\python."
    Therefore, in the command prompt of the trunk folder, type

    "C:\Program Files\BitNami Trac Stack\python\python" setup.py bdist_egg  [Note: the double qoutes are needed to dealing with a path with space.]

  4. The necessary outputs is in the newly created 'dist' folder.  Copy all *.egg files (typically, there is only one egg file for this plugin) from there to Trac's plugin folder.  An example of the plugin folder is
    "C:\Users\username\BitNami Trac Stack projects\InitialProject\plugins"

  5. change trac.ini of a project that wants to use the plugin by including lines
    [components]
    tracrpc.* = enabled

    Note that if the [components] section already exists, there is no need to create a new one.  Just append 'tracrpc.* = enabled' to the section.

  6. Restart the apache service.  It is important to note that the service name is tracApache if you use BitNami.  If you need to run this service from a command line, use
    "C:\Program Files\BitNami Trac Stack\apache2\bin\httpd.exe" -k runservice

If you want to install this plugin for every project, try using easy_install descriped in Trac website.

Visual Studio 2010 Integration

This section is probably why you come to this page.  You may think that you need an installer for integration, but it is not necessary at all.  All you need are compatible add-in binaries and add-in description file.

  1. Download the package I built from this link.  This package includes binaries and description file.  If you are interested in how I prepared the package, see the next section. 

  2. Unpack it to your preferred folder.  No need to bother with "Program Files".  Any folder will do.

  3. Open VS 2010.

  4. Go to 'Tools->Options.'

  5. In the 'Add-in/Macros Security' in the 'Environment' node.  Then, 'Add..' the path to the folder in you chose in Step 2.

  6. Close and reopen VS 2010.

  7. Verify add-in installation: (1) Go to 'Tools->Add-inManager'.  You should see TracExplorer.VSTrac listed there; (2) By clicking 'View' in the menu bar, you should see 'Trac Explorer.'

Preparation of Binary Package

This part is for those who are curious about how I built the add-in from the source code provided in SourceForge.net.

Note: I do not modify any source code.  I just rebuild the binary and add a proper add-in description file.


  1. Install TortoiseSVN in its default folder.  You need TortoiseSVN, as the build script uses a file from TortoiseSVN.  The file is specified by the default path of TortoiseSVN. If you already installed it elsewhere, see note at the end of this section.

  2. Check out the source tree from SourceForge.  The SVN command is 'svn co https://vstrac.svn.sourceforge.net/svnroot/vstrac vstrac.'  If you use TortoiseSVN to do this, just enter the URL https://vstrac.svn.sourceforge.net/svnroot/vstrac.

    Do not use GNU tarball, as the build script needs to obtain some information of the SVN source tree.  This information is automatically available if you use SVN to check out the source tree.

  3. Go to the 'trunk/src' folder.  Use VS 2010 to open TracExplorer2008.sln.

  4. Rebuild the solution in a release mode.  Whatever you try to do, you will get x86 binaries compatible with VS 2010 in the 'trunk/bin' folder.

Note: What if I installed TortoiseSVN in a non-default foder?
In this case, version_scm.bat in the 'build' folder will not work.  You, however, can specify your TortoiseSVN path by modifying the batch file.

Trivia: In SourceForge, this software is called TracExplorer, but in Visual Studio's view, it becomes Trac Explorer (with space added).

Hope this helps,
Pinyo

2 comments:

Uwe said...

After building the XmlRpc Python egg, you can also upload it directly in the administration web GUI and have it automatically installed.

pinyotae said...

@Uwe
Thanks for the tip. I will check it out when I have time.