Skip to content
Mathieu Guindon edited this page May 19, 2017 · 22 revisions

Initial Setup

Thank you for forking our project! Before you can submit a pull request, there are a number of steps that need to be completed.

Building

First step is to get a rubberduck.dll build. To do this, you must be running Visual Studio as administrator.

If you have a release version installed, you need to uninstall it first. The installer registers COM components against the release build, in the install folder. You'll manually re-register these COM components in a minute, but first you need a build.

Building Rubberduck should automatically install the following Nuget packages:

  • ANTLR 4 Runtime
  • ANTLR 4
  • Castle.Core
  • LibGit2Sharp
  • Moq
  • Ninject
  • Ninject.Extensions.Conventions
  • Ninject.Extensions.Factory
  • Ninject.Extensions.NamedScope
  • NLog Schema for IntelliSenseTM
  • NLog

Once you've built the solution, make sure the Rubberduck project is the solution's startup project, and that it's configured to launch your favorite VBE host on startup, so that Visual Studio automatically attaches its debugger to the process when you hit F5 to launch the solution:

Project Properties / Debug / Start Action

Because Rubberduck.dll doesn't have a dependency on Rubberduck.Inspections.dll, and because of the post-build event in the inspections assembly which copies the .dll to the main assembly's build output folder, with the default debugger settings hitting F5-debug won't necessarily build & copy Rubberduck.Inspections.dll, which means if that assembly was modified, then your debug session is loading the previous build of that assembly.

To prevent this, tweak the debugger settings:

Projects and Solutions > Build and Run


Registering the COM types

Building Rubberduck generates a Rubberduck.tlb type library, which exposes COM types such as the AssertClass that client VBA code needs to reference and use to enable the unit testing feature; it also needs to register its dockable toolwindows and other COM types in the Windows Registry.

The installer does this by running regasm.exe with administrative rights, against the release build, in the install folder: you're going to do exactly that, but against your dev/debug build, in your build folder.

  • If your VBE host application is 32-bit, you need to register the assembly using the 32-bit framework.

  • If your VBE host application is 64-bit, you need to register the assembly using the 64-bit framework.

The bitness of your OS is irrelevant.

Bring up an administrative command prompt (cmd.exe), and execute one of the following commands:

32-bit host:

c:\windows\microsoft.net\framework\v4.0.30319\regasm.exe "(path to project \bin folder)\rubberduck.dll" /codebase /tlb

64-bit host:

c:\windows\microsoft.net\framework64\v4.0.30319\regasm.exe "(path to project \bin folder)\rubberduck.dll" /codebase /tlb

You should see these output messages:

Microsoft .NET Framework Assembly Registration Utility version 4.6.1038.0 for Microsoft .NET Framework version 4.6.1038.0 Copyright (C) Microsoft Corporation. All rights reserved.

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.

Types registered successfully


Registering the add-in

Registering the COM types isn't enough. Every VBE host application will be looking for installed addins under a specific registry key in the HKCU hive.

Bring up the Windows Registry Editor, and depending on the bitness of the VBE host(s) you want to register Rubberduck with, create a Rubberduck.Extension key:

32-bit hosts:

HKCU/SOFTWARE/Microsoft/VBA/VBE/6.0/Addins/Rubberduck.Extension

64-bit hosts:

HKCU/SOFTWARE/Microsoft/VBA/VBE/6.0/Addins64/Rubberduck.Extension

The Rubberduck.Extension COM type was registered when you ran the regasm.exe command in the previous step. If you have both 32-bit and 64-bit VBE host applications and you want both to load the Rubberduck add-in, you'll need to create the two keys. Otherwise, just create the key that you need for the bitness of your VBE host.

Define the following values under the Rubberduck.Extension key:

  • Description (string value): "Rubberduck"
  • FriendlyName (string value): "Rubberduck"
  • LoadBehavior (DWORD): 3

Rubberduck.Extension 64-bit registry key values


Not sure where or how to start? See Architecture Overview.

Clone this wiki locally