Creating an add-in

3/30/2010 8:19 PM
You can subscribe to this wiki article using an RSS feed reader.

Folder Structure

I suggest setting up the following folder structure.  It's not mandatory, but the instructions on this page are based on this structure.  Note that I'm assuming this structure is inside of a specific branch in your source control (e.g. /trunk or /releases/v1.0, etc.).

  • AvalonDock
    • (AvalonDock projects go in here)
  • NLog
    • (NLog project goes in here)
  • Physics2D
    • (Physics2D projects go in here)
  • References
    • (DLLs like the MEF library go in here)
  • SoapBox
    • SoapBox.Utilities
      • (SoapBox.Utilities project goes here)
    • SoapBox.Core
      • (all SoapBox.Core projects go in here, each in their own folder)
  • YourNamespace
    • YourSubNamespace1
      • (your projects go in here, each in their own folder)
    • YourSubNamespace2
      • (or in here)
  • bin
    • (Both SoapBox.Core and your projects will all compile into here, so they can find each other)

Visual Studio Solution

  1. Create a Visual Studio Solution for whatever it is you're building in the root directory.
  2. You will need to include all of the SoapBox.Core projects in this solution.  I suggest putting them in a SoapBox\SoapBox.Core solution folder.
  3. SoapBox Core will have project references for AvalonDock, NLog, and Physics2D, so you will need to include these in your solution as well.
  4. I suggest creating solution folders for your own projects.  First create a top level one for YourNamespace, then sub folders for each of YourSubNamespaces.
  5. Create a new WPF User Control project, give it a name like YourNameSpace.YourSubNamespace.AddInName.  In the location box, specify the \YourNameSpace\YourSubNamespace directory.  This will create a new folder under that directory and place your new project in there.
  6. Your new project will have an automatically created user control called UserControl1.  You can delete this.
  7. Add a reference to the \References\System.ComponentModel.Composition.dll
  8. Edit your project properties for this new project and go to the Build tab.  Change Output path to ..\..\..\bin so that the DLL will be deposited in the bin directory with the Host executable.
  9. Add a project reference for this new project to SoapBox.Core.Contracts.  This gives you access to interfaces and helper classes you will need to add menu items, tool bars and tool bar items, status bars, options pads, documents and tool pads to the workbench, along with grabbing references to the logging component.
  10. Add a project reference for this new project to SoapBox.Utilities.  This gives you access to the NotifyPropertyChangedHelper, which is a fundamental tool for creating ViewModel classes.
  11. If you want to build something based on the Arena module (the 2D simulator), you will also need a project reference to SoapBox.Core.Arena, but this is optional.
  12. When you build the project, you should see your new Add-In DLL in the \bin directory.  When SoapBox.Core.Host.exe runs, it will scan that DLL for exports that extend the SoapBox.Core library modules.  Of course, you haven't written any yet, so it won't do anything...

Home: SoapBox Core What's new: Recently changed articles