I use Visual Studio 2012 and .Net Framework 4.5 I have 2 solutions: 1) WPF application 2) Class library (dll)
The class library contains 3 buttons and a control that must be inside the WindosFormsHost control since it was created for WinForms.
The only referenced assemblies outside the .NET Framework are for the aforementioned winforms and iTextSharp controls.
The winforms control seems old, and when I put the link in my dll, I got the same error as the header, but after other SO questions / answers, I put this in my configuration file:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> </configuration>
Error:
The mixed mode assembly is built against the runtime version "v2.0.50727" and cannot be loaded into runtime 4.0 without additional configuration information
As I mentioned, I saw issues related to this problem, and they solved the problem in my DLL project, but in a project using this DLL, I tried all of them to no avail. For reference:
In this project, my configuration file has the same tags with the same values.
Also note that in my WPF application, at the beginning I received an error message that I could not find the specified DLL (for the winforms control), in the end I put this control DLL in the GAC.
I tried to change my target structure for all features (4.5, 4.0 and client, 3.5 full and client, 3.0 and 2.0), creating my DLL in debugging and release and setting “Generate serialization assembly” to OFF, also changed the platform’s goal from any processor to x86 and x64. I was just trying to change the value of one setting at a time.
Is this a problem in VS2012 or what do I need to do to solve this problem?
EDIT:
The above error is shown during development in the error list, the designer shows the error: "Unable to create an instance of" my_class "
The internal exception to this says: “Set connectionId threw an exception”, and the internal exception is the header message.
This still allows me to create a solution, and when I start the application, I get basically the same thing, except that the innermost exception says:
"Could not load file or assembly" SigPlusNET, Version = 1.1.3358.14336, Culture = neutral, PublicKeyToken = 6aef07010bb0624f "or one of its dependencies. An attempt was made to load a program with the wrong format."
This is one of the control builds of winForms. When checking through dotPeek, the only dependencies it has are the .NET Framework.