Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 15 and Version 16 of Documentation/DevelopmentCenter/CreateNewPluginUsingVS


Ignore:
Timestamp:
06/26/14 19:26:27 (10 years ago)
Author:
abeham
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/DevelopmentCenter/CreateNewPluginUsingVS

    v15 v16  
    5959[[Image(solution.png)]]
    6060
    61 Every !HeuristicLab plugin needs a Plugin file. This file contains information about the plugin itself (Name, Filename, Version) and it's dependencies.
    62 The dependencies are used by the plugin infrastructure to check if all required plugins for a certain plugin are found.
    63 Therefore write the following code in your Plugin.cs file:
     61Every 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 we will write the following code in our Plugin.cs file:
    6462
    65  {{{#!csharp
    66 
     63{{{
     64#!csharp
    6765using HeuristicLab.PluginInfrastructure;
    6866
    69 namespace HeuristicLab.Algorithms.MyAlgorithm {
    70   [Plugin("HeuristicLab.Algorithms.MyAlgorithm", "1.0.0.0")]
    71   [PluginFile("HeuristicLab.Algorithms.MyAlgorithm.dll", PluginFileType.Assembly)]
    72   public class MyAlgorithmPlugin : PluginBase {
     67namespace HeuristicLab.GreatIdea.ThePlugin {
     68  [Plugin("HeuristicLab.GreatIdea.ThePlugin", "Provides an implementation of a great idea", "3.3.9.0")]
     69  [PluginFile("HeuristicLab.GreatIdea.ThePlugin.dll", PluginFileType.Assembly)]
     70  public class Plugin : PluginBase {
    7371  }
    7472}
     73}}}
    7574
    76   }}}
     75'''Important''': The plugin class needs to derive from HeuristicLab.PluginInfrastructure.PluginBase so that the dll is realized as a plugin. The attributes specify the details of the plugin and which files it provides. The filename given in PluginFile has to be the same as the assembly output filename in the "Application" tab of the project's properties.
    7776
    7877'''Important''': Changing major or minor version numbers in the course of development marks a breaking change to previously saved files. If HeuristicLab wants to load an item of a plugin with version 3.3.8 it will accept the same plugin in version 3.3.9 to open it. However, it will reject the plugin when its major or minor is different (e.g. 3.2.7, 3.4.3 or 4.0.1). The "Assembly file version" is not used by HeuristicLab and can be set without any restrictions.
    7978
    80 === Build path ===
    81 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:
     79== Testing the plugin ==
    8280
    83 [[Image(output_path.png)]]
    84 
    85 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.
    86  
    87 
    88 == Testing the plugin ==
    89 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":
    90  
     81 * Build the project and press <Ctrl+F5> to start it without a debugger attached
     82 * You will see the starter window again, but you already know the switches to hide it
     83 * Inside the starter open the "Plugin Manager" and see that it is correctly loaded
    9184
    9285[[Image(plugin_manager.png)]]
    9386
    94 == Where to go from here ==
    95 Take a look at [[wiki:UsersHowtosImplementAnAlgorithm| this page]] which describes how to create a basic HL algorithm.
     87Now we have created an empty plugin that we can use to implement a new great idea. Please refer to the [[Documentation]] pages and the various HowTos on how to write views, operators, algorithms, etc.
    9688
    9789