Free cookie consent management tool by TermsFeed Policy Generator

Version 11 (modified by abeham, 8 years ago) (diff)


Quick guide: Create a new plugin with Visual Studio

We assume that you have obtained the source as described in Quick guide: Download and build sources. We assume your directory structure looks as follows:

A new solution

We will now create a new Visual Studio solution and add a class library project which will become the HeuristicLab plugin.

  • In Visual Studio select "File > New > Project..." or press <Ctrl+Shift+N>
  • Use the "Blank Solution" template
  • In this guide we'll use "GreatIdea" as name and choose the extension folder as location

No image "create_solution.png" attached to Documentation/DevelopmentCenter/CreateNewPluginUsingVS

Next we add a new project to this solution.

  • In the Solution Explorer right-click the "GreatIdea" solution and select "Add > New Project..."
  • On the right choose "Visual C#" and select the "Class Library" template
  • In this guide we'll pick "HeuristicLab.GreatIdea.ThePlugin"

Your working directory should now look something like this:

Configuring the project


Optionally you can change your AssemblyInfo.cs file. This is useful is you want to publish multiple version of your plugin later. We set the AssemblyVersion to the same value as the current HeuristicLab major version by convention. The assembly version should be incremented if you use the HL serialization mechanism and want to signal a persistence break between two versions. The AssemblyFileVersion is not used by HeuristicLab and can be set without any restrictions:


Every HL plugin has at least a reference to PluginInfrastructure as this is needed for the Plugin.cs file. Therefore add a reference to this plugin:

Plugin file

Visual Studio has already created a cs file when creating the project. Rename this file to Plugin.cs:

Every HeuristicLab plugin needs a Plugin file. This file contains information about the plugin itself (Name, Filename, Version) and it's dependencies. The dependencies are used by the plugin infrastructure to check if all required plugins for a certain plugin are found. Therefore write the following code in your Plugin.cs file:

using HeuristicLab.PluginInfrastructure;

namespace HeuristicLab.Algorithms.MyAlgorithm {
  [Plugin("HeuristicLab.Algorithms.MyAlgorithm", "")]
  [PluginFile("HeuristicLab.Algorithms.MyAlgorithm.dll", PluginFileType.Assembly)]
  public class MyAlgorithmPlugin : PluginBase {

Build path

The last step is to adjust the output path for the plugin. Because we don't want to copy the plugin file by hand to the HeuristicLab bin directory, we set the output path to this location so that it gets directly built there. Right click on your project, choose Properties and then the Build register card:

The output path is set as a relative path. This makes it possible for other people who may have a different directory layout (e.g. no C:\HL\) to also build the project.

Testing the plugin

You should now be able to compile your project and find your plugin file in the HeuristicLab bin folder. To test if everything works and the plugin infrastructure recognizes the plugin, start HeuristicLab an double click the Plugin Manager application in the Starter dialog. Your plugin should be listed under "Active Plugins":

Where to go from here

Take a look at this page? which describes how to create a basic HL algorithm.

Attachments (10)

Download all attachments as: .zip