Error using this library

Aug 30, 2012 at 5:59 PM

Hello,

i'm having a bit of a problem trying to use this project.

I would need to reference this API in a new project that could be open from a web application. But when I try to "reference" the dlls needed to run the program, the .NET gives me a error saying:

You can't add a reference to Graphviz4net.WPF.dll as it was not built against the Silverlight runtime. Silverlight projects will only work with Silverlight assemblies.

It does this in all of the dlls.

Has this happend with anyone else? Does anyone now the reason and the solution?

Best regards,

MP 

Coordinator
Aug 30, 2012 at 6:17 PM

Hi there,

well it seems that you are trying to use the assemblies in a silverlight application. The current release (Graphviz4Net Beta) does not support silverlight, however, some initial support for silverlight has been done (but not released yet). So i suggest you download the latest version from source control and build it yourself. It will produce more assemblies, because there are some new projects. What you want then, is to go into directory "src\Graphviz4Net.SL\Bin\Debug" and copy assemblies AntrlRuntime3SL.dll, Graphviz4Net.Core.SL.dll and Graphviz4Net.SL.dll into your project folder and reference them instead of Graphviz4net.WPF.dll

Usage of the Graph visual component in silverlight is, however, little bit different as silverlight does not support DataTemplates (for which we all are thankful, dear Microsoft, sigh). There is an example project in the Graphviz4Net solution that shows usage of Graphviz4Net in silverlight. You will probably want to implement your own IWPFLayoutElementsFactory to tell silverlight&graphviz4net which graphical elements should represent which ViewModels (that kind of substitutes DataTemplates).

Also, at the moment, the demo uses AutomationFactory to invoke the graphviz command line tool. This means that you will not be able to use it in a web application anyway, but you can implement your own IDotExeRunner which will call a web service that will then use DotExeRunner to run dot.exe on the server and will return the results back to the web application.

Well, good luck and don't be afraid to ask if you have any more questions,
Steves

Aug 31, 2012 at 3:59 PM

Hello,

first of all thank you for your quick response. I had some minor problems related with the framework of Silverlight that I needed to have installed so I could be able to build the GraphViz4Net application and generate the dlls that you told me.

Now the next step is a bit tricky for me.

From what i see i'll need to create a webservice in my web app that will be read by my silverlight app.

This webservice, on the web app side, will call dot.exe... And for that I'll need to insert the GraphViz4NetCore.dll in my webapp also right?

Is there an example of this calling in any of your apps?? Maybe in a testing app?

Also the interface that exists in the WPF application isn't replicated in the SL application. Maybe I should first of all try this on the GraphViz4Net solution. Or have I got the wrong version of the GraphViz4Net from source control? 

Coordinator
Sep 1, 2012 at 9:43 AM

You will need all the assemblies in your silverlight webapp. For the web service you will only need Graphviz4Net.Core.dll and AntlrRuntime.dll and because the web service won't be in silverlight runtime (i guess) you will use the normal ones, not the silverlight version.

The implementation of the web service: it's only going to instantiate DotExeRunner and call methods on it, then forwarding results to your web application. In the web application there will be your implementation of IDotExeRunner which will only call the web service, will wait for the result and return the result as if it was calculated locally. The rest of the web application won't be affected at all. It's called remote proxy pattern so you might find some better explanation in Wikipedia or somewhere else.