Background
There are many functions common to multiple BAGIS tools. Two examples are opening a shapefile or checking to see if a selected folder contains the required files for a valid AOI. To avoid including multiple copies of this code, we use the concept of a shared class library. We will refer to this class library as "BAGIS_ClassLibrary". A list of the modules and functions included in the BAGIS_ClassLibrary may be found here. The aforementioned document may be incomplete as the BAGIS_ClassLibrary is usually updated if a BAGIS module is changed but it serves as a good starting point.
If you have a suggestion for a new subroutine that could be shared by multiple BAGIS tools or need to change the arguments for a subroutine in the BAGIS_ClassLibary, work with the developer who maintains the BAGIS_ClassLibrary to have these changes included in the next version.
The BAGIS_ClassLibrary is a distinct project and does not include any of the user interface components (forms, buttons, Config.esriaddinx file). Microsoft Visual Studio Professional (VS) supports solutions containing more than one project. The three primary BAGIS tools each have a solution containing at least two projects. These two projects are the the user interface portion, for example BAGIS_H, and the BAGIS_ClassLibrary project.
If you are starting a new solution and wish to include the BAGIS_ClassLibrary project, download the latest .zip file for the BAGIS_ClassLibrary from the NWCC folder on the FTP website to a local directory on your computer. Unzip the file and use the "Add new item" functionality in VS to add the new project. Make sure to get the correct BAGIS_ClassLibrary for the tool you are working on. See the notes below on ArcMap Add-In limitations. You will also need to add the BAGIS_ClassLibrary project as a reference to the project that needs to use it.
Figure 1: Adding the BAGIS_ClassLibrary project as a reference for BAGIS-H
As with most VS references, you need to add the "Imports BAGIS_ClassLibrary" statement at the top of any forms or modules that use BAGIS_ClassLibrary functions if you don't wish to to fully qualify the function call.
If you are using an older version of the BAGIS_ClassLibrary and it needs to be replaced by a new one, best practices call for deleting the old version from your VS solution and references. Close VS, open the containing folder and delete the old BAGIS_ClassLibrary in the folder. Then, paste your new class library there. Finally, restart VS and add the updated version (i.e., File/Add/Existing Project...) from the path you have just pasted into your containing folder as if you were using it for the first time. You need to select the .vbproj file in the BAGIS_ClassLibrary folder. Note that you may have compilation errors if the arguments to a function have changed. Fix these errors before trying to compile your solution.
Unfortunately the ArcGIS Add-In framework can only work with one version of BAGIS_ClassLibrary at a time. This can cause errors for users who use more than one BAGIS tool. For example, if BAGIS-H is released in June and BAGIS-P is released in September, they will likely have different versions of the BAGIS_ClassLibrary. If ArcMap tries to use BAGIS-P, it uses the BAGIS_ClassLibrary from BAGIS-H. This will cause errors because the older BAGIS_ClassLibrary is missing functions required by BAGIS-P.
To avoid this problem and allow each BAGIS tool to have its own release schedule, the 'Assembly Name' for the BAGIS_ClassLibrary is unique to each solution (tool). This allows ArcMap to use the correct BAGIS_ClassLibrary for each tool. The BAGIS_ClassLibrary developer will keep the underlying class modules in sync so that the latest code can be included with each tool's release. See notes below for the BAGIS_ClassLibrary developer.
Figure 2: The BAGIS_ClassLibrary assembly name is unique to each tool. This is the assembly name for BAGIS-H.
Table 1: BAGIS applications and the names of their assemblies
The version of the BAGIS_ClassLibrary is maintained in a Public constant in the ConstantsModule named BA_CLASS_LIBRARY_VERSION. When you make changes to the BAGIS_ClassLibrary, increment this version number. This ensures that developers can easily tell which version of the BAGIS_ClassLibrary is used by their tool.
To distribute changes to each tool, use the Windows copy-and-paste functionality to copy a module or enumeration from one BAGIS_ClassLibrary to another. Make sure to include the aforementioned ConstantsModule so that the version number is current. After the changes are made, zip up the project or solution and post it to the NWCC FTP server with the current date. Inform all BAGIS developers that a new version is available so they can begin using it.