I'm using Visual Studio 2012 and the .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 has to be inside a WindosFormsHost control since it was made for WinForms.
The only referenced assemblies outside of the .NET Framework ones are for the aforementioned winforms control and iTextSharp.
The winforms control seems to be kinda old and when I put the reference in my dll I got the same error as the title but following other SO questions/answers, my I put this in my config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
The error:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information
As I mentioned, I've seen questions posting this issue, and they did solve the issue in my DLL project, but in the project using that DLL I've tried them all to no avail. For reference:
- What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?
- Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime
- What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?
- Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime
- Mixed mode assembly is built against version X and cannot be loaded in version Y of the runtime without additional configuration information
In that project my config file has the exact same tags with the same values.
Also to note, in my WPF Application, at the beginning I was getting an error about it not being able to find the specified dll (for the winforms control), in the end I put that control's dll in the GAC.
I've tried changing my target framework for all of the possibilities (4.5, 4.0 full and client, 3.5 full and client, 3.0 and 2.0), building my DLL in debug and release and setting the "Generate serialization assembly" to OFF, also, changed the platform target from Any CPU to x86 and x64. I only tried changing the value of one setting at a time.
Is this a problem in VS2012 or what do I need to do to solve this?
EDIT:
The above error is shown at design time in the errors list, the designer shows an error saying "Cannot create an instance of 'my_class'"
The inner exception of that one says: "Set connectionId threw an exception" and the inner exception of this is the title message.
This still allows the solution to be built, and upon running the application, I get basically the same, 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 an incorrect format."
That one is the winForms control's assembly, upon inspection through dotPeek, the only dependencies it has are .NET Framework ones