.NET 4.0 Custom Graph Provider

Jan 13, 2012 at 5:39 PM
Edited Jan 13, 2012 at 5:58 PM

I am trying to implement a custom graph data provider using the IGraphDataProvider interface. As far as I understand, my project needs to target the .NET Framework 3.5 for NodeXL to detect it. Unfortunately, I am referencing another assembly in my provider that requires .NET 4.0 and forces me to use this version of the framework for the provider as well.

I can use my provider with the NodeXL WPF control in a .NET 4.0 environment and am pretty sure that it would work as expected, except that it doesn't show in the "Import" dialogue in Excel. 

Can I somehow update NodeXL so that it also accepts .NET 4.0 graph data providers or do I absolutely HAVE TO use .NET 3.5?

Thanks in advance!

Jan 15, 2012 at 6:22 PM
Edited Jan 15, 2012 at 6:25 PM

The .NET Framework supports backward compatibility but not forward compatibility. So your .NET 4.0-dependent assembly isn't going to run in a .NET 3.5 application like NodeXL.

The long-term fix for this problem, which hasn’t arisen until now, is for us to port our entire solution to Visual Studio 2010 and .NET 4.0. We haven’t done that yet, for three reasons:

1. It will lock out developers who are still using Visual Studio 2008. This becomes less important as time passes.

2. The solution's multiple projects will need to be thoroughly tested, and in particular I anticipate problems with NodeXL’s setup program. The setup has always caused me huge headaches, and I will be shocked if it ports over without causing more of the same.

3. It will require a big download of .NET 4.0 on target machines that don’t already have it.

Until we bite the bullet and port the solution, here is one workaround you might consider:

A. Implement a .NET 4.0 command-line executable that gets your data and formats it as GraphML. Have it accept command-line arguments that specify the data to get, and have it write the GraphML results to a known file location. (The file location can be specified as one of the arguments.)

B. Implement your IGraphDataProvider as a .NET 3.5 assembly that can be loaded by NodeXL. It would be nothing but a very thin wrapper that makes a Process.Start() call to your executable, then loads the resulting GraphML file and passes the XML document back to NodeXL.

It’s a small bit of a kludge, but it should work just fine. And when we port NodeXL, you can always refactor your importer into a single .NET 4.0 assembly, like other importers. If you structure your code so the bulk of it is in a class that knows nothing about where it’s being called from, the refactoring should be easy.

One warning: The current NodeXL setup program checks for the existence of .NET 3.5 and installs it if necessary. It will not check for .NET 4.0, so you are on your own for that requirement.

That’s the best I can offer right now.

-- Tony

Jan 15, 2012 at 6:47 PM

Hi Tony,

Alright, that's what I thought and I will stick with the "thin-wrapper workaround" until NodeXL is ported to .NET 4.0.

Thanks for your comprehensive answer and keep up the good work!