Search code examples
c#asp.net-webpageswebmatrix-3

How do I get System.Web.UI.DataVisualization.Charting dll into WebMatrix 3?


I want to use the full charting options available in ASP.NET Web Pages in WebMatrix 3.

I think this means using System.Web.UI.DataVisualization.Charting

When adding:

using System.Web.UI.DataVisualization.Charting

to the top of my page, I get the error:

Compiler Error Message: CS0234: The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?)

There are plenty of tutorials out there (including on SO) demonstrating how to download and reference the dll into Visual Studio, but as far as I can see there's nothing for us WebMatrix users.

Does this mean that it can't be used in a WebMatrix site? If so, why??

If anyone knows how to include the relevant namespace in WM, I'd be very grateful if you'd explain it here.


Solution

  • WebMatrix doesn't provide a mechanism for adding references. However, you can work around this by right clicking on the bin folder and choosing Add Existing File. Then you need to locate System.Web.Datavizualization.dll, which on my machine is located in C:\Windows\Microsoft.NET\Framework\v4.0.30319. Once you have a copy of that dll in your bin folder, you are in business.

    I would however recommend moving across to Visual Studio. Then it's simply a case of using File » Open » Web Site to open your WebMatrix site folder.