Skip to content

HowTo:Create customization dll

Anna edited this page Feb 25, 2015 · 2 revisions

In this article we look through process of creation customization dll. Let's imagine you have dll, that contains next structure:

namespace Namespace
{
  public class Class
  {
    public Class()
    {
    }

    public Class(string str)
    {
    }

    public Class(int i, string str)
    {
    }

    private string query;
    public string Query
    {
        set { value = query; }
        get { return query; }
    }

    public void Action(string str)
    {
        Query = str;
    }
  }
}
  1. Add resource file

image

image

  1. Add icons to resource file. About giving icon name you can read here.

image

  1. Open .csproj file

  2. Uncomment BeforeBuild and AfterBuild parts.

  3. Add next code under <Target Name="BeforeBuild">:

<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v2.0">

<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />

</GetReferenceAssemblyPaths>

  1. After </GetReferenceAssemblyPaths> you may write all resources, those you want to be included in customization dll. OutputAssembly must be like: NameOfDll.customization.dll.

e.g.

<GenerateResource UseSourcePath="true" Sources="$(ProjectDir)DLLImages.resx" OutputResources="$(ProjectDir)DLLImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />

<AL TargetType="library" EmbedResources="$(ProjectDir)DLLImages.resources" OutputAssembly="$(OutDir)DLL.customization.dll" />

In the end you have to have such .csproj file:

<Target Name="BeforeBuild">

<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v2.0">

<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />

</GetReferenceAssemblyPaths>

<GenerateResource UseSourcePath="true" Sources="$(ProjectDir)DLLImages.resx" OutputResources="$(ProjectDir)DLLImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />

<AL TargetType="library" EmbedResources="$(ProjectDir)DLLImages.resources" OutputAssembly="$(OutDir)DLL.customization.dll" />

</Target>

  1. Rebuild project. In output folder you would find customization dll.

image

Keep this dll in the same folder as your main dll.

  1. Import your main dll in Dynamo.

image

  1. And you get result:

image