Publishing problem "could not load file or assembly 'System.Windows.Forms'..."

0
0

Hi guys,

This is something new I have never seen before.
I’m trying to publish a new small application (3.2). It starts ok on the “production” server, it opens the Login page, but when the login button is clicked, I get the attached error “could not load file or assembly ‘System.Windows.Forms’…”. The only thing the login button click method does is to set Appication.MainPage = new MainPage();
It works ok on my dev machine.

Any ideas?
Alex

  • You must to post comments
0
0

Hello Alex,

Are you trying to deploying the app as a .NET 48 or .NET 7 application?

What server environment are you using?

Best,
Alaa

 

  • You must to post comments
0
0

Hi Alaa,

I did a publishing to folder, with target 6.0.
went to the publish folder and copied all the stuff, transfered it to a folder under inetpub\wwwroot,
created a new application pool in IIS, created a new application  in that pool,
commented out the aspnetcore line in the web.config

and ran. It opens the login page but as soon as I press the button I get the error.

  • You must to post comments
0
0

Hi Alex,

Looks like your app is trying to load .NET 48 or Systems.Windows.Forms.

Wisej for .NET Core doesn’t reference or use SWF, any library that uses it will fail on .NET Core, check the references in your project and make sure that it’s only referenced for .NET 48!

Try deploying a Wisej app that has a single page, and a button without adding any third party libraries to check!

Best,

Alaa

  • You must to post comments
1
0

Hi Alaa,

Thanks for your answer. I did what you suggested and compared the publish folder contents. In the problematic publishing there was a folder “refs” containing a System.Windows.Forms.dll (along with other dlls). I couldn’t remember this folder from earlier deployments / Wisej versions. I removed the publish folder and re-published in a fresh folder with target net6.0. I also removed the <Asliases>swf</Aliases> for the System.Windows.Forms.dll reference in my project file. After that it worked as expected. Now I need to answer the question why was this “refs” folder there and why there was this <Aliases>.

Thanks for your answers.
Alex.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.