Create Excel document with DocumentFormat.OpenXml gives 'DocumentFormat' could not be found

I am trying to create an excel file including graphs from C# script.
For that I try to use the DocumentFormat.OpenXml library
I import it and I can see that the import was done correctly
but when I try to compile the program I get the error
The type or namespace name ‘DocumentFormat’ could not be found (are you missing a using directive or an assembly reference?)
I use
using DocumentFormat.OpenXml; 3.0.2.0
using DocumentFormat.OpenXml.Framework; 3.0.2.0
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using X14 = DocumentFormat.OpenXml.Office2010.Excel;
using X15 = DocumentFormat.OpenXml.Office2013.Excel;

I have downloaded the libraries from https://www.nuget.org/
I have tried with spreadsheetlight.3.5.0
but in the end I get the same error: ‘DocumentFormat’ could not be found.
If I compile and run the code in VS 2022 ir runs correctly.
I took the example from Creating Excel File Using OpenXML

Could you help me to solve this error please?

Hi guy.
You can use other library.
if you need step by step, you can inbox private to me.