Could not load file or assembly 'System.Windows.Forms….. (Visual studio 2019)

  • Thread starter Thread starter Jinge47
  • Start date Start date
J

Jinge47

Guest
Have problems with Visual Studio 2019, where I have created a solution with 2 projects. The start-up project (# 1) has been created with the Console App (.NETCore) as a base. The second project (# 2) is based on the Windows Forms app (.NET Framework)


Project 1 contains the main logic and calls a procedure in project 2 that will set up a form, take care of specified values and return this via global variables. Both projects do their jobs separately. It is when it comes to the call that errors occur. The call has been adapted as the initial syntax error occurred which has now been corrected so compilation of the solution is error free and without warnings. When executed, there is an interruption


System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Det går inte att hitta filen.'


This means that it is not possible to track in the program as I wanted. Of course, there are differences in the two projects' .NET environments that make up for it, but it is not told how I can get hold of the missing file.


Question 1. Does anyone know how to get the file and how it is then incorporated into the environment?


I am not a VB encoder so that with Objects, classes, methods etc. is not something I have immersed myself in. However, I can do so much that I can make it work as regular calls with arguments and so on.


The call itself is simple in itself and I think I got to that with how to send the information. However, I do not find anywhere the values that the parameters should contain.


Call MYform1.Form1_Load(Mysender, Myargs)


Question 2. Does anyone know how to find which values should be included in the Mysender and Myargs parameters



In the log I find this


'Project20200727.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.6\System.Private.CoreLib.dll'.

'Project20200727.exe' (CoreCLR: clrhost): Loaded 'C:\Users\janne\source\repos\Project20200727\bin\Debug\netcoreapp3.1\Project20200727.dll'. Symbols loaded.

'Project20200727.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.6\System.Runtime.dll'.

'Project20200727.exe' (CoreCLR: clrhost): Loaded 'C:\Users\janne\source\repos\Project20200727\bin\Debug\netcoreapp3.1\WindowsApp3_20200730.exe'. Symbols loaded.

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.

Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Det går inte att hitta filen.


The program '[13828] Project20200727.exe' has exited with code -1 (0xffffffff).



Best regards

Janne

Continue reading...
 
Back
Top