Introduction

This page will guide you through each step necessary to build and debug VsTortoise.


Required Software


Prerequisites

You must uninstall any VsTortoise installation first. Why this is necessary is explained later.


Directory Structure

Here is a briefly overview what modules are located in which directory.

Commands
Contains all commands. A command is the action behind a button, "Show Log" or "Commit" for example.

Dialogs
  • About dialog
  • Open modified Files dialog

OptionPages
VsTortoise integrates in to Visual Studio options. Those pages are located in this directory. PageBase.cs is the base class for all option pages.

Resources
Contains all icons, images, resource files and build scripts for the VsTortoise satellite DLL.


First Build

VsTortoise must not be installed on your computer, because you want to load and debug the add-in "bin\VsTortoise.dll" you build. Before you can debug the add-in, you must copy the file "VsTortoise.AddIn" to "C:\Users\%USERNAME%\Documents\Visual Studio 2008\Addins\VsTortoise.AddIn", modify it to match your Visual Studio version and set the path where "bin\svn16\VsTortoise.dll" is located. All pathes here are for VS 2008 and SVN1.6, change to match your setup

The VsTortoise Visual Studio Solution contains two projects: "VsTortoise" and "VsTortoise_SVN17". That is because both require different assemblies. The output files are stored in "bin\svn16" and "bin\svn17". Setting just the "Startup Project" to use one or the other is not going to work, you need to set the path to the generated VsTortoise.dll file in the .AddIn file instead.

Open "C:\Users\%USERNAME%\Documents\Visual Studio 2008\Addins\VsTortoise.AddIn" in notepad and:
  • Set your Visual Studio version in VsTortoise.AddIn
  • Set the path in VsTortoise.AddIn to point to "bin\svn??\VsTortoise.dll" you just built. Replace the ?? with your SVN version, either "svn16" or "svn17".

Here is how mine looks:
The following .addin XML snippet is most likely out of date! For a proper .addin file, please refer to "trunk\Code\VsTortoise.AddIn" in the repository instead
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">

	<HostApplication>
		<Name>Microsoft Visual Studio</Name>
		<!--
		8.0 for Visual Studio 2005
		9.0 for Visual Studio 2008
		10.0 for Visual Studio 2010
		-->
		<Version>9.0</Version>
	</HostApplication>
  
	<Addin>
		<FriendlyName>VsTortoise</FriendlyName>
		<Description>TortoiseSVN add-in for Visual Studio 2005/2008 standard or higher</Description>
		<!-- This path must point to the VsTortoise DLL in your build directory -->
		<Assembly>C:\Users\crash\Documents\Visual Studio 2008\Projects\VsTortoise\trunk\Code\bin\svn16\VsTortoise.dll</Assembly>
		<FullClassName>VsTortoise</FullClassName>
		<LoadBehavior>1</LoadBehavior>
		<CommandPreload>1</CommandPreload>
		<CommandLineSafe>0</CommandLineSafe>
	</Addin>

	<ToolsOptionsPage>
		<Category Name="VsTortoise">
			<SubCategory Name="General">
				<!-- This path must point to the VsTortoise DLL in your build directory -->
				<Assembly>C:\Users\crash\Documents\Visual Studio 2008\Projects\VsTortoise\trunk\Code\bin\svn16\VsTortoise.dll</Assembly>
				<FullClassName>VsTortoiseSVN.OptionPages.GeneralPage</FullClassName>
			</SubCategory>
			<SubCategory Name="Integration">
			        <!-- This path must point to the VsTortoise DLL in your build directory -->
				<Assembly>C:\Users\crash\Documents\Visual Studio 2008\Projects\VsTortoise\trunk\Code\bin\svn16\VsTortoise.dll</Assembly>
				<FullClassName>VsTortoiseSVN.OptionPages.IntegrationPage</FullClassName>
			</SubCategory>
		</Category>
	</ToolsOptionsPage>
</Extensibility>



Save and close the file. Now rename it to "VsTortoise.AddIn_", yes, with an underscore at the end. Visual Studio searches for .addin files and loads them at startup, but you don't want it to load the add-in yet or to be more precise when you open Visual Studio to actually build it (the add-in), since it would try to write to a file which is used by another process (TM). Keep this in mind.

Now open VsTortoise_2008.sln, which is the solution file for Visual Studio 2008 and hit Build. Users of Visual Studio 2005 have to create their own solution/project for now (feel free to contribute). Once you did build the solution, "bin\VsTortoise.dll" should be available.
  • Rename "VsTortoise.AddIn_" to "VsTortoise.AddIn" again. When a new instance of Visual Studio starts, it finds the .addin file and loads it. Alternately if you use Visual Studio 2008, you can also hold down SHIFT to prevent VS from loading .addin files, this way you don't need to do the rename workaround, however the hold SHIFT down stuff does not work with 2010!
  • Open the VsTortoise project settings, switch to the Debug tab
    • Paste the following text in start options command line arguments:
/resetaddin VsTortoise /rootSuffix Exp /RANU 
  • Select "start external program" as start action and specify "devenv.exe" from you Visual Studio installation

vstortoise_project_settings_debug.png

Now hit F5 to debug VsTortoise. A new Visual Studio instance should start and load VsTortoise. Now open "Commands\About.cs", set a breakpoint in About.Exec() and then click Mainmenu -> VsTortoise -> About. The debugger should halt at the breakpoint. Voilá.


Building the satellite DLL

Texts and images are located in the satellite DLLs. Building the DLL only needs to be done when Images.resx or Texts.resx changed and is not integrated in to the Visual Studio build process. Both .resx files are located in the Resources sub folder.

I created "Resources\build.cmd" and "Resources\buildall.cmd" that generate the satellite DLLs and copy them to the "bin\<culture-id>" directory where VsTortoise.dll should be located. To execute "build.cmd" or "buildall.cmd", you have to open a Visual Studio command prompt: Startmenu -> Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt.

"build.cmd" expects a culture-id as parameter. I recommend to just execute "buildall.cmd", which, as the name suggests, builds resource dll's for all cultures as specified in "Resources\cultures.txt".


Building the installer

You need to have installed InnoSetup. Make sure to build the VsTortoise project in Visual Studio first. Then open the file "Installer/VsTortoise.iss" file in InnoSetup. At the top of the .iss file you find the following #defines:
#define APP_VERSION                 "30"
#define APP_BETA                    "alpha"
#define APP_SVN_VERSION             "1.7"
These #defines must match the version you earlier built in Visual Studio. At the time you click "Compile" in InnoSetup, the tool copies the necessary files from the Visual Studio project output folder, packages them up and stores the final installer in "Installer/Output/".

Last edited Oct 28, 2013 at 7:03 PM by pschraut, version 21