wiki:Documentation/DevelopmentCenter/CreateNewPluginUsingSD

Version 2 (modified by abeham, 5 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:

/raw-attachment/wiki/Documentation/DevelopmentCenter/CreateNewPluginWithVS/working_dir.png

A new solution

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

  • In SharpDevelop select "File > New > Solution..." or press <Ctrl+Shift+N>
  • Use the "Class Library" template
  • In this guide we'll use "GreatIdea" as solution name and choose the extension folder as location, the plugin will be named "HeuristicLab.GreatIdea.ThePlugin"

Your working directory should now look something like this

/raw-attachment/wiki/Documentation/DevelopmentCenter/CreateNewPluginWithVS/working_dir_new.png

Configuring the project

Assembly information

In the projects tree view on the left you will see a folder "Properties" below the project with a file AssemblyInfo.cs. Edit that file. In HeuristicLab we set the assembly version to the same value as the current HeuristicLab version by convention. It should only include major and minor, build and revision should always remain 0. 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. The assembly file version can include the whole version string.

using System;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("HeuristicLab.GreatIdea.ThePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HEAL")]
[assembly: AssemblyProduct("HeuristicLab")]
[assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and 
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("3.3.0.0")]
[assembly: AssemblyFileVersion("3.3.9.0")]

Project properties

In the project's properties (right-click on the project) we configure: Signing, compiling, and debug. If you open the properties please also make sure the target framework is set to .NET Framework 4.0.

Signing

Activate "Sign the assembly" and create a new key or browse to use the HeuristicLab.snk inside the plugins of StableRoot. Otherwise call the new key "TheKey".

Compiling

We want to automatically put the plugin into the StableRoot\bin folder when we compile it. On the "Compiling" tab change the output path to ..\..\..\stable\bin, click on the small dot button in front and remove the check in front of "Configuration-specific" so that this options holds regardless of which platform or configuration we build for.

Debug

On the "Debug" tab choose "Start external program" and select HeuristicLab.exe inside StableRoot\bin. Again remove the "Configuration-specific" check and instead add a check to "Store in .user-file".

Save and close the project's properties. These changes ensure 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.

Attachments (3)

Download all attachments as: .zip