- ago
The BuildingBlock API documentation for Initialize() says:
QUOTE:
Here you can change the LibraryName, which determines the name of the node that your Building Block appears under in the WL8 Building Blocks list.


I tried, but can't get a library name different form the assembly name.

May I have a working code example that sets the LibraryName for a BuildingBlock?
0
284
Solved
9 Replies

Reply

Bookmark

Sort
Cone8
 ( 7.89% )
- ago
#1
I've never had to assign LibraryName. Just use the Name field.

CODE:
public class MyBlock: ConditionBuildingBlock { public override string Name => "My Block's Name"; :

Edit: In my experience, the Assembly name is used as the LibraryName (without assigning it).
0
Glitch8
 ( 11.29% )
- ago
#2
Did you assign a value to the LibraryName property?
0
- ago
#3
Yes, I tried:
CODE:
public override void Initialize() { LibraryName = "finantic.MyFancyBlocks"; }


and

CODE:
public ConstructorOfMyClass() { LibraryName = "finantic.VeryFancyBlocks"; }

None of these works.
0
- ago
#4
Here is what I found works. The Name property is the name of the building block. The node in the tree is the name of the assembly. So, edit the class library properties and change the Assembly Name property to what you want, with a couple of caveats:

- If the Assembly Name contains a space then the tree node will appear with quotes around the name.
- If the Assembly Name contains one dot, then the node will have the part of the name after the dot.
- If the Assembly Name contains more than one dot, then the node will be whatever comes after the first dot.

Note that if you rename the DLL, it will still use the Assembly Name info in the DLL.

Hence, here is a simple do-nothing exit building block:

CODE:
using WealthLab.Backtest; namespace MyBuildingBlock; public class MyEntryExitBb : EntryExitBuildingBlock { public override string Name => "Paul's Exit Building Block"; public override void Initialize() { base.Initialize(); } }


Here is the setting for the class library (I use JetBrains Rider IDE, but should be similar for Visual Studio):



And...



0
- ago
#5
Hi paul, many thanks for this elaborate research.

This is (of course) a solution.

But still the advertised (documented) way does not work :(
0
Glitch8
 ( 11.29% )
- ago
#6
We will work on getting this working as advertised!!
1
Glitch8
 ( 11.29% )
- ago
#7
We've got it working as expected for the next release.
1
Best Answer
- ago
#8
Hmmm.... this took 25 minutes....
... you should get some blue band ... ;)
0
Glitch8
 ( 11.29% )
- ago
#9
It was a trivial fix 🤷🏼‍♂️ Wish they were all that easy!
0

Reply

Bookmark

Sort