Skip to content

Contributing

INOPIAE edited this page Jan 10, 2023 · 24 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.

For a smooth setup, have your local clone in a path without special characters, e.g. C:\Dev\GitHub\Rubberduck. Some build components (heat.exe) have been reported to throw errors given special characters in the path, e.g. C:\Dev\C#\Rubberduck.

Make sure you uninstall any release build of Rubberduck before you build a debug build.

Building

Because we have custom build system and some dependencies, it is best to build the whole solution. The debug release will be based on the Rubberduck.Deployment project and because that project depends on several other projects it is almost the last to build. Though the actual files used for addin come from other projects (e.g. Rubberduck.Core), the registration will be done using the Rubberduck.Deployment's path. The project additionally will do some configurations, including executing powershell scripts and editing the registry to maintain the COM registration automatically. We try to make that project automated as much as contributors should not have to tweak it to get building. For those interested, refer to Build Process for details within the Rubberduck.Deployment project.

Debugging

IMPORTANT: If you want to debug Rubberduck by F5'ing, you might run Visual Studio in non-admin mode to avoid issues with Rubberduck registration. Because the registration will be in HKCU, running the VBE host as an administrator might prevent it from seeing the registration and thus give an error about being unable to locate the Rubberduck addin. If you must run Visual Studio as an administrator, consider attaching to the VBE host instead of F5'ing.

Once you've built the solution, make sure the Rubberduck.Deployment 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

For Visual Studio 2022 go to the properties of Rubberduck.Deployment

Rubberduck.Deployment Properties / Debug

Open the debug launch profiles UI

Rubberduck.Deployment debug lauch profiles UI / Create new

Add a new executable profile and select your favorite VBE host on startup.

Rubberduck.Deployment debug lauch profiles UI / Start Action

Select the desiered debug profile.

Rubberduck.Deployment / Select Debug Profile

If there were any build errors, it is possible that your debug session is loading the previous build of that assembly.

To prevent this, tweak the debugger settings:

Projects and Solutions > Build and Run


Dependig on your Visual Studio Edition install the following features:


Registering the COM types

Building the Rubberduck solution should normally perform a registration of the COM types automatically for you. Refer to Build Process for full details.

Note: for historical information you can read about registering with regasm.exe. It is STRONGLY recommended that you do NOT use this with the current build process however.

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.

Copy the commands below into a text editor and save as Rubberduck.reg, and then open the file to have Windows automatically add the entries to the registry, or see below for step-by step instructions:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins\Rubberduck.Extension]
"Description"="Rubberduck"
"FriendlyName"="Rubberduck"
"LoadBehavior"=dword:00000003

[HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins64\Rubberduck.Extension]
"Description"="Rubberduck"
"FriendlyName"="Rubberduck"
"LoadBehavior"=dword:00000003

Alternatively, 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

Registering the add-in

If you'd like to delete the registry entries, copy the commands below into a text editor and save as RubberduckUnregister.reg, and then open the file to have Windows automatically remove the entries from the registry, or see below for step-by step instructions:

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins\Rubberduck.Extension]

[-HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins64\Rubberduck.Extension]

Alternatively, open the Registry Editor and delete the keys:

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

Project convention

The Rubberduck project has several projects which divides the responsibility and concerns. Not all projects are ultimately consumed by the users of the RD.

Those projects that are used in the final release version will typically have a prefix Rubberduck., with a period. Those that are internal for supporting the development will have prefix of Rubberduck, without the period. Note that all user-facing projects must reference the RubberduckCodeAnalysis project. See here for more details.


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

Clone this wiki locally