-
Notifications
You must be signed in to change notification settings - Fork 1
HowTo:Create customization dll
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;
}
}
}
- Add resource file
- Add icons to resource file. About giving icon name you can read here.
-
Open .csproj file
-
Uncomment BeforeBuild and AfterBuild parts.
-
Add next code under
<Target Name="BeforeBuild">
:
<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v2.0">
<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />
</GetReferenceAssemblyPaths>
- 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>
- Rebuild project. In output folder you would find customization dll.
Keep this dll in the same folder as your main dll.
- Import your main dll in Dynamo.
- And you get result: