bindingsource not does not exist in the current context????
1 Context:
I'm using
<PackageReference Include="FastReport.Core" Version="2021.1.2" />
And I had to update the FastReport.Compat to this:
<PackageReference Include="FastReport.Compat" Version="2025.2.11" />
Because I was having an weird error and found an answer here in the forum.
My solution has 3 projects:
Library that holds my report objects (netstrandard2.0)
ASP.NET MVC web application (.NET 8.) which provides an API to export a report to PDF.
WinForms .NET Framework application only used to design and preview my reports.
2 What is working?
I can design and preview my report using my objects in the WinForms application as expected. And I saved the frx file from there. I looked into the frx file and the 'bindingSource1' is defined there.
3 What is not working?
In my ASP.NET MVC I'm loading my objects and passing it to a Report object, simply like this:
using var report = new Report();
report.Load(templatePath);
report.RegisterData(dataSource, bindingSourceName);
report.PreparePhase1();
report.PreparePhase2();
The exception below is raised on the PreparePhase1() method.
I can't figure out what is wrong because I had another project with similar setup (instead of MVC is a ASP.NET Core Web API .NET 8) and everything works.
Any idea???
FastReport.Utils.CompilerException: '(Text5): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text6): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text7): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text8): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text9): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text10): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text12): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text12): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text15): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text20): Error CS0103: The name 'bindingSource1' does not exist in the current context
(Text21): Error CS0103: The name 'bindingSource1' does not exist in the current context
at FastReport.Code.AssemblyDescriptor.InternalCompile()
at FastReport.Code.AssemblyDescriptor.Compile()
at FastReport.Report.Compile()
at FastReport.Report.PreparePhase1()