I'm in a Console App (.Net Framework) project and cant use windows.forms, I'm using a .Net Framework Console App because I was not able do it in a .Net Core app either. Specifically trying to call a class from System.Windows.Forms.DataVisualization. I understand that it is a windows form app but is there a work around? If not can some one explain why the common language runtime cannot doesn't allow me to reference something from the Forms module?

In order to find it at all in Console App I used nuget to retrieve HIC.System.Windows.Forms.DataVisualization, however when I try to reference it I get the below message. I'm new to .net/visual studio, is there a simple fix to this someone can assist me with?

A reference to 'System Windows_Forms' could not be added.

The ActiveX type library

'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Windo ws.Forms.tlb' was exported from a .NET assembly and cannot be added as a reference.

Add a reference to the .NET assembly instead.

Below is a screen shot of the error message:

I appreciate any help and/or info I can get.
Best regards.

@MM , Welcome to Microsoft Q&A, based on my test, I could add the System.Windows.Forms.DataVisualization assembly in the console app successfully.

First, please right-click Add-Reference and then choose the Assemblies tab.

Second, please input System.Windows.Forms.DataVisualization in your searchbox and choose the correct option.

Third, after clicking ok and you could use the assembly, like the following code:

using System.Windows.Forms.DataVisualization.Charting;  
namespace ConsoleApp1  
    internal class Program  
        static void Main(string[] args)  
            Chart chart = new Chart();  

Hope my advice could help you.
Best Regards,

If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.