I’m trying to use the Dynamic Data Display (D3) library for displaying graphs in a Silverlight 5 application (out-of-browser). Whenever I try to add “DynamicDataDisplay.dll” as reference, it gets removed again after I close the dialog.
I can however use the reference in a normal Windows Forms or WPF project. So is this some restriction with the Silverlight framework?
What can I do about this? Maybe compile D3 myself in a different way?
Silverlight applications can only use assemblies compiled by Silverlight projects. There are exceptions but for anything UI related it’s always true.
As a result, if you want to use a third-party library in your Silverlight application, it needs to have a special Silverlight version to use instead of the normal version. The “normal” version is sometimes called the .NET4 version or the WPF version to contrast it with the Silverlight version.
The net effect is that Silverlight is for all practical purposes not binary compatible with the full CLR. But there is a considerable amount of source compatibility including large sections of the core framework and a partially incompatible subset of WPF.
In fact the standard approach to building parallel WPF and Silverlight assemblies is to use two projects that link all the same source files with some conditional compilation.
Luckily for you, as @dtb pointed out, Dynamic Data Display already supports a Silverlight download. But the same applies to any third-party library you might consider using: it needs to come in a Silverlight flavor.