SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Andreas Weizel

June 2013 - Posts

  • Publishing an AddIn for SharpDevelop 5

    As I've already mentioned in my first post about new AddIn Manager, SharpDevelop team has introduced an online repository where you can publish your SharpDevelop 5 AddIns. It's visible to all SharpDevelop users, so they can download and install your AddIn directly through AddIn Manager. We utilize NuGet as well-proven platform for package distribution. The repository itself is hosted on MyGet.

    This blog post will show you how to package your AddIn and make it visible to other people.

    Creating an initial AddIn package

    Let's start with a small fictitious sample AddIn called "AddInManager2Test" adding an item to the main menu. More details about development of SharpDevelop AddIns can be found in our Wiki. Assume that the AddIn has been already created using the "SharpDevelop addin" solution template and contains some code:

    Begin with the .addin file describing your AddIn. Here it's important to set a unique identity:

    <AddIn name="AddInManager Test"
           author ="Andreas Weizel"
           description="Just a test AddIn to demonstrate how to publish it.">
       
        <Manifest>
            <Identity name="AWeizel.AddInManager2Test" />
        </Manifest>
       
        <Runtime>
            <Import assembly="AWeizel.AddInManager2Test.dll"/>
        </Runtime>
       
        <!-- Some sample menu item added to main menu -->
        <Path name = "/SharpDevelop/Workbench/MainMenu/Help">
            <MenuItem id="ShowAddInManager2"
                      label="Test Command"
                      class="
    AWeizel.AddInManager2Test.ShowCommand"/>
        </Path>
    </AddIn>

    Since our repository is based on NuGet, you will need an additional NuGet package description (also called "Nuspec"). It's another XML file which you can add directly to your solution. In this example I've called it AddInManager2Test.nuspec, corresponding to project name:

    <?xml version="1.0"?>
    <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
      <metadata>
        <id>AWeizel.AddInManager2Test</id>
        <version>1.0.0.0</version>
        <authors>Andreas Weizel</authors>
        <owners>Andreas Weizel</owners>
        <projectUrl>http://www.icsharpcode.net/OpenSource/SD/</projectUrl>
        <description>AddInManager2 Test AddIn</description>
        <tags>SharpDevelop AddIn Test Blog</tags>
      </metadata>
      <files>
        <file src="bin\Release\AddInManager2Test.addin" target="" />
        <file src="bin\Release\AWeizel.AddInManager2Test.dll" target="" />
      </files>
    </package>

    You can freely define most of the metadata values as you need them. Most important are <id> and <version>. The NuGet ID uniquely identifies the package in repository. I recommend to use the same value here as for the AddIn's identity defined earlier in .addin file. The version tag allows to distinguish between different releases of the AddIn.

    In the <files> section you define which files have to be added to your package release. You can refer to your build output directory and add at least the assembly file and the .addin file. The target attribute in <file> element sets a relative subdirectory path, where the file will be placed inside the package's directory structure (remember: NuGet packages are technically ZIP archives). SharpDevelop AddIn packages must contain all .dll and .addin files at root level, otherwise later installation will fail. That's why the target attribute has been left empty in the example above.

    To learn more about possible options in Nuspec, please have a look at the Nuspec Reference in NuGet Docs.

    Before creating and publishing the package from the .nuspec file, you now need:

    • a recent NuGet command line client, which you can download from NuGet server (simply download nuget.exe and add it to your PATH)
    • a MyGet account to get write-access to SharpDevelop package feed. Registration is free.

    After these steps open a command line in your project directory and create the package specifying the name of your .nuspec file:

    nuget pack AddInManager2Test.nuspec

    In my example this generates the package file AWeizel.AddInManager2Test.1.0.0.0.nupkg named after NuGet ID and version of the package. So it's time to push it to public repository:

    nuget push AWeizel.AddInManager2Test.1.0.0.0.nupkg <Your-API-Key> -s https://www.myget.org/F/sharpdevelop/

    Replace "<Your-API-Key>" with the key you see in your myget.org account settings under "Security":

    After successful publishing your new package should be available in AddIn Manager:

    From here it can be downloaded and finally installed:

     

    Publishing an update

    After publishing an AddIn for the first time you will likely want to release an update later. So make all changes you need to the code and increase the package version in your .nuspec file:

    <?xml version="1.0"?>
    <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
      <metadata>
        <id>AWeizel.AddInManager2Test</id>
        <version>1.0.1.0</version>
        <authors>Andreas Weizel</authors>
        <owners>Andreas Weizel</owners>
        <projectUrl>http://www.icsharpcode.net/OpenSource/SD/</projectUrl>
        <description>AddInManager2 Test AddIn</description>
        <tags>SharpDevelop AddIn Test Blog</tags>
      </metadata>
      <files>
        <file src="bin\Release\AddInManager2Test.addin" target="" />
        <file src="bin\Release\AWeizel.AddInManager2Test.dll" target="" />
      </files>
    </package>

    After executing

    nuget pack AddInManager2Test.nuspec

    again the command line utility will generate a new name for the package: AWeizel.AddInManager2Test.1.0.1.0.nupkg

    After pushing it to repository using

    nuget push AWeizel.AddInManager2Test.1.0.1.0.nupkg <Your-API-Key> -s https://www.myget.org/F/sharpdevelop/

    all users of your AddIn will see the update in AddIn Manager:

     

  • Introducing new AddIn Manager in SharpDevelop 5

    SharpDevelop allows to extend its features by installing AddIns. With SharpDevelop 5 we bring a new and modern AddIn Manager interface into the IDE:

    AddIn Manager's main window

    It can be found at the same place as the former one (Menu Tools / AddIn Manager) and supports installing, updating, disabling or removing SharpDevelop AddIns.

     

    Installation from online repository

    Completely new is the possibility to connect to an online NuGet-based repository to install or update your AddIns from. A central repository maintained by the SharpDevelop Team will be predefined. Custom repositories can be added through preferences. You can browse all repositories through the navigation bar on the left:

    Navigation bar

    Selecting one repository shows installable NuGet packages containing SharpDevelop AddIns:

    Available NuGet package

    After clicking the Install button the NuGet package is downloaded and marked for installation:

    NuGet package marked for installation

    A restart of SharpDevelop is needed to complete the installation. After that the AddIn will be shown in the "Installed" list:

    AddIn installed from a NuGet repository

     

    Installation from package file

    As in SharpDevelop 4 we still support installing an AddIn from an *.sdaddin package file:

     Installation from archive button

    Selecting an .sdaddin package

    After selecting the archive the procedure is the same as with NuGet-packaged AddIns: It will be marked for installation ...

    Archive package marked for installation

    ... and after restarting SharpDevelop it will appear among other AddIns:

     

    AddIn installed from an .sdaddin package

     

Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.