I have a solution structure like this:
+ Solution
+ HardwareStore
+ MyBenchmark
+ PlayGround
+ Program.cs
PlayGround is a console application project, I added this project to my solution to experiment with new libraries and concepts.
I want to experiment with Sylvan.Data.Excel inside Program.cs :
namespace PlayGround
{
using Sylvan.Data;
using Sylvan.Data.Excel;
public class MyRecord
{
public int Id { get; set; }
public string Name { get; set; }
public int? Quantity { get; set; }
public DateTime Date { get; set; }
}
public class Experiment
{
public void BindExcelDataToObjects()
{
using var edr = ExcelDataReader.Create("data.xlsx");
foreach (MyRecord item in edr.GetRecords())
{
Console.WriteLine($"{item.Name} {item.Quantity}");
}
}
}
class Program
{
static void Main()
{
Experiment e = new Experiment();
e.BindExcelDataToObjects();
}
}
}
Sylvan.Data and Sylvan.Data.Excel are installed.
Inside the PlayGround project, I run this command:
PS D:\Training\NETLEARNING\Solution\PlayGround> dotnet build Program.cs
I get the following error:
D:\Solution\PlayGround\Program.cs(4,11): error CS0246: The type or namespace name 'Sylvan' could not be found (are you missing a using directive or an assembly reference?)
D:\Solution\PlayGround\Program.cs(5,11): error CS0246: The type or namespace name 'Sylvan' could not be found (are you missing a using directive or an assembly reference?)
Why does that happen even though I installed the packages ?