Page 1 of 1

Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Mon May 30, 2022 6:02 pm
by Milton Guevara
Hi, I'm using Net 6, with a library-type project to generate a report that exports to PDF, but when executing I get the following error: "Could not load file or assembly 'System.Windows.Forms, Version=4.0. 0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified."
The libraries that I have installed are from Stimulsoft and are ".NETCoreApp3.1", which are supposed to be compatible with Net6
please your support

Regards
Milton

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Tue May 31, 2022 6:10 am
by Max Shamanov
Hello,

You should add a reference to the assembly, by using the following code:

Code: Select all

using System.Windows.Forms;
Also please check our samples:
https://github.com/stimulsoft/Samples-N ... rms-CSharp

Thank you.

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Tue May 31, 2022 2:55 pm
by Milton Guevara
Hello Max
It is not a "Windows Form" project, I am working on a "Library" type project where Forms is not referenced.

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Wed Jun 01, 2022 9:37 am
by Lech Kulikowski
Hello,

You can remove that assembly from the (Referenced Assemblies) property of the report.

Thank you.

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Wed Jun 01, 2022 2:09 pm
by Milton Guevara
Hello

The error occurs in the line where the "StiReport" is instantiated, not in the load of the report.

StiReport report = new StiReport();

In which report should I remove the reference?

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Wed Jun 01, 2022 8:46 pm
by Lech Kulikowski
Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Thu Jun 02, 2022 11:56 pm
by Milton Guevara
It was fixed by replacing "Stimulsoft.Reports.Engine" with "Stimulsoft.Reports.Enginee.NetCore".
Thanks for the support.

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Fri Jun 03, 2022 7:18 am
by Max Shamanov
Hello,

You are welcome!

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Sun May 19, 2024 9:06 am
by custodian
Thanks

Re: Could not load file or assembly 'System.Windows.Forms' in Net6

Posted: Mon May 20, 2024 6:08 am
by Max Shamanov
Hello,

You are welcome!