Getting and compiling T4 Toolbox source code


Over the past year, several people have asked me to provide instructions on how to compile T4 Toolbox. The process is not difficult, but since I don’t do it every day, I have to dig through my email archive to find all the steps every time I need to provide the answer. This seems to be as good time as any to write everything down, so here it goes…

You will need latest versions of the following tools installed in order to compile T4 Toolbox.

Installing Tools

You can install most of the tools with default options.

  • When installing StyleCop, make sure that MSBuild integration files feature is installed.

StyleCop installation options

  • SDC Tasks don’t have an installer; binary files come in a ZIP archive. For T4 Toolbox, you will need to extract these files to C:\Windows\Microsoft.NET\Framework\v3.5 directory.

Extracting SDC Tasks

  • Open the extracted Microsoft.Sdc.Common.tasks XML file and comment out the <PropertyGroup/> element in the beginning of the file (enclose it with <!– and –>). This element generates warnings during compilation.
  • Unless you have BizTalk installed on your workstation, you will also need to comment out the entire section at the bottom of this file that declares BizTalk tasks implemented in Microsoft.Sdc.Tasks.BizTalk.dll assembly. Otherwise you will see a large number of errors referring to BizTalk assemblies during compilation.

Accessing Source Code

You have two different ways of getting T4 Toolbox source code. If you have not been added to the list of developers,

Source Code page of T4 Toolbox project on Code Plex

  • After accepting the license agreement, you will be prompted to download a ZIP archive that contains the latest version of the T4 Toolbox source code. Save the file to your local hard drive first and unblock it before extracting the files. Unless you unblock the ZIP archive first, the Visual Studio will not “trust” it and you will get obscure security errors and warnings later on.

Unblock downloaded ZIP archive

  • Extract all files from this archive to a folder on your hard drive, such as C:\T4Toolbox, and open T4Toolbox.sln located in the Source subfolder.

T4 Toolbox source code on local hard drive

  • When Visual Studio opens T4 Toolbox solution for the first time, select the Load project normally option. T4Toolbox.csproj uses MSBuild extensions from SDC tasks and StyleCop, you will need to select this option in order to compile it.

image

At this point, you should be able to compile the T4 toolbox. Make changes until it works the way you need it and then upload the files you modified as a patch on CodePlex. Myself or someone else will take a look at the changes you’ve made and commit them to the main source code of the project.

Using Team Explorer

When you are regularly working on T4 Toolbox source code, having to download a source code snapshot becomes a hassle. When your CodePlex account has been added to the list of T4 Toolbox developers, you can start using Team Explorer from Visual Studio.

  • Download and install Team Explorer from here.
  • Once you have it installed, go to T4 Toolbox page on CodePlex, make sure you are logged (1), open the Source Code tab (2) and then click the Visual Studio Team Explorer link (3). On the right-hand side, you will see the information you will need to use in Team Explorer (4).

Team Explorer instructions

  • In Visual Studio, select View->Team Explorer from the main menu.
  • In Team Explorer, click Add Existing Team Project button
  • In the Connect to Team Foundation Server dialog, click Servers button
  • In the Add/Remove Team Foundation Server dialog, click Add button
  • In the Add Team Foundation Server dialog, enter server name, port number and protocol from the CodePlex page and click OK.

Add T4Toolbox Project to Team Explorer

  • Back in the Add/Remove Team Foundation Server dialog, click Close button
  • Back in the Connect to Team Foundation Server dialog, select T4Toolbox project and click OK button
  • Back in Team Explorer, you should now see the T4Toolbox project and its information.

image

  • Double-click the Source Control node to open Source Control Explorer

Source Control Explorer

  • In Source Control Explorer, select T4Toolbox folder on the left side and click the Not mapped link on the right.
  • In the Map dialog, enter name of the local folder you want to use for T4 Toolbox source code and click Map button.

Map workspace dialog

  • Back in Source Control Explorer, click Get Latest Version  button to download the source code to your local hard drive.
  • Once downloaded, double-click T4Toolbox.sln in the Source sub-folder to open the solution.

Get Latest Version and Open Solution from Source Control Explorer

At this point, you can check files out, change them and check them in. The source control functionality is similar to Visual SourceSafe and Subversion, so it should be familiar to most developers.

Previous Articles

T4 Toolbox: LINQ to SQL schema generator


Crossing Domain Boundaries: Windows Authentication


Crossing Domain Boundaries: Name Resolution


Simplifying TFS: Applying hot fixes without branching


T4 Editor by Tangible Engineering


T4Toolbox build 9.3.21.1 problem


T4 Toolbox: Generating files in different folders and projects


T4 Tutorial: Making code generators extensible


February Meeting of Tampa Bay IASA Chapter


Welcome

Thank you for taking the time to visit my site! If you are looking for information about T4, this article would be a good place to start.

If you like what you see on this site, take a minute to visit my company, Catapult Systems. Check out their services and ask how we can help you on your project. See you around!