You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This document describes how the new layout of Delta Shell developer projects is defined and how it can be expanded with new products and projects. The Delta Shell Framework is split up into separate NuGet packages that can be imported into C# projects in order to develop plugins for Delta Shell.

Creating a Product File Structure

When you start from scratch with a completely new project where Delta Shell doesn't have any plugins for, you start by creating a new C# solution (*.sln). There is a place to actually add this file to svn, although you are not obliged to put it there. You may also make your own svn repository. But if the Delta Shell team agrees, you could put your new files and folders in svn under https://repos.deltares.nl/repos/delft-tools/trunk/delta-shell/Products/[YourProductName].

Screenshot of the repository where products are stored.

Create a solution and a csproj file in your folder. Make it as the following structure with a src and a test folder.

This is the default way of making a solution and the plugin csprojs that come along. Of course, you can do this in visual studio. The csproj that you add should be a class library, because we are going to make a plugin and the plugin is a dll that will be loaded by Delta Shell.

Download the Delta Shell SDK

Now that we have our csproj set up, we need to download the SDK, so we can start making our plugin. The first thing we do, is add the file nuget.config next to our sln file. Remember to fill in the password for dscbuildserver. This file ensures that NuGet will be able to find the download page for the NuGet packages. It is also required on TeamCity later on in this tutorial.

NuGet.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value="packages"/>
  </config>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
    <add key="TeamcityAuth" value="https://build.deltares.nl/httpAuth/app/nuget/v1/FeedService.svc/" />
    <add key="Teamcity" value="https://build.deltares.nl/guestAuth/app/nuget/v1/FeedService.svc/" />
  </packageSources>
  <activePackageSource>
    <add key="TeamcityAuth" value="https://build.deltares.nl/httpAuth/app/nuget/v1/FeedService.svc/" />
  </activePackageSource>
  <packageSourceCredentials>
    <TeamcityAuth>
      <add key="Username" value="dscbuildserver" />
      <add key="ClearTextPassword" value="[DSCBUILDSERVERPASSWORD]" />
    </TeamcityAuth>
  </packageSourceCredentials>
</configuration>

Now open the Package Manager Console in Visual Studio. You can download the Delta Shell SDK by calling the command Install-Package DeltaShell.Framework -Version x.x.x.xxxx. This will install DeltaShell.Framework into the packages folder next to your sln file. And it will also add a reference to DeltaShell.Framework in your csproj.

Because we want to make an ApplicationPlugin, we are going to need another package. Install it in the same way via the Package Manager ConsoleInstall-Package DeltaShell.ApplicationPlugin -Version x.x.x.xxxx. To stay consistent, use the same version number.

Make sure that you always use the latest pinned version from TeamCity. Omitting the -Version option will give you the latest successful build, but this is not desired.

DeltaShell.ApplicationPlugin

What's in the DeltaShell.ApplicationPlugin package? Well, it saves you a lot of time setting up your project. First of all, it ensures that your project will build to the correct output location. Which is $(SolutionDir)bin\$(Configuration)\plugins\$(AssemblyName). Doing so speeds up the building process. I will tell more about this concept later on in this tutorial.

It also adds some extra Assembly Info, so that the Mono.Addins library knows that this assembly is a plugin assembly.

DeltaShell.Framework

The DeltaShell.Framework package ensures that all files in the framework are on your computer. It also adds a .targets fie to your project so that it will copy the framework files into $(SolutionDir}bin\DeltaShell.

DeltaShell.TestProject

You can also make a unit test project that works in Delta Shell. To do so, install the DeltaShell.TestProject package into your test project. Take notice of the Default Project in the Package Manager Console, because you want the DeltaShell.TestProject to be in your test project and not in your application plugin project.

Adding dll references

While you are

  • No labels