Using NMath Charts with .NET 4.0

The NMath Chart DLLs (NMathChartMicrosoft.dll and NMathStatsChartMicrosoft.dll) are built against the .NET 3.5 version of the Microsoft Chart Controls for .NET (System.Windows.Forms.DataVisualization). The .NET runtime will not automatically replace this reference with the version of the Microsoft Chart DLL built into the .NET 4.0 Framework, unless you explicitly tell it to do so by adding the following lines to your app.config:

<configuration> ... <runtime> ... <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> ... <dependentAssembly> <assemblyIdentity name="System.Windows.Forms.DataVisualization" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="3.5.0.0-3.5.0.0" newVersion="4.0.0.0"/> </dependentAssembly> ... </assemblyBinding> ... </runtime> ... </configuration>

In this way, your application with charts can be deployed to both .NET 3.5 and .NET 4.0. Please note that all other NMath assemblies (with non-visual functionality) can be used in .NET 3.5 and .NET 4.0 without this step.

See this tutorial for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *

Top