59 | | * Open a new instance of Visual Studio 2012 or later |
60 | | * Select "File > New > Project..." or press <Ctrl+Shift+N> |
61 | | * In the dialog on the top select ".NET Framework 4" |
62 | | * On the right choose "Other Project Types > Visual Studio Solutions" and select the "Blank Solution" template or alternatively type "Blank Solution" in the search box on the right |
63 | | * Use "GreatIdea" as Name and click "Browse..." to select the `extension` folder and click Ok |
64 | | * In the Solution Explorer right-click the "GreatIdea" solution and select "Add > New Project..." |
65 | | * On the right choose "Visual C#" and select the "Class Library" template |
66 | | * As name pick "HeuristicLab.GreatIdea.ThePlugin" |
67 | | |
68 | | You're presented with a minimal project set up for developing a new class library (dll). Before we continue we want to adjust the project configuration to make development convenient. |
69 | | |
70 | | * Open the project properties and go to "Build" |
71 | | * Change the first box from "Active (Debug)" to "All Configurations" |
72 | | * Enter `..\..\..\stable\bin` in the output path |
73 | | * Then click on "Debug" on the left, choose "Start external program" and select HeuristicLab.exe inside StableRoot\bin - this setting is stored in the .csproj.user file |
74 | | * Then click on "Signing" on the left, activate "Sign the assembly" and create a new key |
75 | | * Call it "TheKey", but deselect the password option |
76 | | * Save the project and close the properties |
77 | | |
78 | | This ensures that the generated plugin is automatically added as a plugin to the HeuristicLab build and that we can use our solution to start a debugging session (shortcut <F5>). Now, we want to make this class library a HeuristicLab plugin. This requires that we include a special class that designates this dll to be a plugin. |
79 | | |
80 | | * For the project add a reference to `HeuristicLab.PluginInfrastructure.dll` in StableRoot\bin |
81 | | * Open the properties of the reference and set "Copy Local" to false |
82 | | |
83 | | Later on in your developments you will have to add additional plugins as references, but the procedure is always the same. |
84 | | |
85 | | * Rename `Class1.cs` to `Plugin.cs` by selecting it and pressing <F2> |
86 | | * Replace the code in the file with the following code snippet |
87 | | |
88 | | {{{ |
89 | | #!csharp |
90 | | using HeuristicLab.PluginInfrastructure; |
91 | | |
92 | | namespace HeuristicLab.GreatIdea.ThePlugin { |
93 | | [Plugin("HeuristicLab.GreatIdea.ThePlugin", "Provides an implementation of a great idea", "3.3.9.0")] |
94 | | [PluginFile("HeuristicLab.GreatIdea.ThePlugin.dll", PluginFileType.Assembly)] |
95 | | public class Plugin : PluginBase { |
96 | | } |
97 | | } |
98 | | }}} |
99 | | |
100 | | '''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. |
101 | | |
102 | | '''Important''': Version numbers for plugins can be specified in the style major.minor.build.revision. In the official HeuristicLab repository the revision part is synchronized with the SVN revision number, it can be simply set to 0 in our case. Changing major or minor version numbers in the course of development marks a breaking change to previously saved files. If HeuristicLab's persistence comes across 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.minor is different (e.g. 3.2.7, 3.4.3 or 4.0.1). For this reason HeuristicLab plugin assemblies are always marked with major and minor numbers at the end, e.g. HeuristicLab.Core-3.3.dll. This allows to have the same assembly in two conflicting versions. |
103 | | |
104 | | * Build the project and press <Ctrl+F5> to start it without a debugger attached |
105 | | * You will see the starter window again, but you already know the switches to hide it |
106 | | * Inside the starter open the "Plugin Manager" and see that it is correctly loaded |
107 | | |
108 | | Now we have created an empty plugin that we can use to implement our great idea. Please refer to the [[Documentation]] pages and the various HowTos on how to write views, operators, algorithms, etc. |
| 59 | * Follow the instructions on how to [[Documentation/DevelopmentCenter/CreateNewPluginWithVS|create HeuristicLab plugins with Visual Studio]] |