Adding License Key For DLL

i am using method Diagram.LicenseKeyForDLL(“provided Key”) in my module .
but on my build machine the watermark is still visible .
just wanted to confirm if this is the right way to do it .


Are you calling this in a static initializer or static constructor in your module? Otherwise it might be called too late, after a Diagram is constructed in XAML or whatever.

We have added it in static method .same place where module is initialized .
It’s working for the development system but not on the build machine .
Any idea?

Only if the static method is called during static initialization of the module.

Here’s what we recommend:

private static string _LK = Northwoods.GoXam.Diagram.LicenseKeyForDLL("...");

This can be placed in xaml.cs too. Or do
we need to place it in static class itself?

You have to execute the call before any Diagram is constructed. The rules for order of evaluation of static initializers and static constructors between different modules are a bit complex – you can find that information on the web.