C#: CSVHelper - CsvConfiguration Not Found

2021.10.30 | 116 words |

Problem

I’m using CSVHelper to read in CSVs for my C# projects. I’m trying to use the CsvConfiguration object to configure my reads, but I’m getting errors with:

The type or namespace name 'CsvConfiguration' could not be found (are you missing a using directive or an assembly reference?)

Solution

In order to use CSVHelper, you have to create a using statement on the top of your files in which you reference it. To get the base library, you can add to the top of your files:

using CsvHelper;

However, other configuration options like CsvConfiguration do not live in that namespace. They live in another namespace which you can add to your file by adding:

using CsvHelper.Configuration;

 

About the Ham

Hi I'm Hamilton - I built this! If you want more content like this subscribe to my email list, connect with me around the web, or take a look at some of my other projects.

More Projects

comments powered by Disqus