Web Api .net 6 System.Windows.Forms problem

Posted by: hrvoje.zirdum on 21 September 2023, 12:07 am EST

    • Post Options:
    • Link

    Posted 21 September 2023, 12:07 am EST

    Hello,

    i have a ASP.Net Core Web Api .net 6 project in wich I using a C1 printing package. When I run project i get this error:

    “System.TypeInitializationException: The type initializer for ‘C1.C1Preview.C1PrintDocument’ threw an exception.

    —> System.IO.FileNotFoundException: Could not load file or assembly ‘System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=345435345345’. The system cannot find the file specified.”

    Can anyone help me with this?

    Thx

  • Posted 23 September 2023, 10:36 am EST - Updated 23 September 2023, 10:41 am EST

    Hello,

    The C1PrintDocument seems to older version dll. We are not sure if you are using C1Report or C1PrintDocument dll itself. But in this case, the solution should be as follows:

    1. Set the TargetOS to Windows for Project Properties
    2. Also set the following in the ReportProject file

    Also, if the error occurs, add the package for System.Windows.Forms.

    Hope it helps!

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels