1

"FileLoadException was unhandled by user code" (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 the matter above.i got exception when try to execute

        Axapta axapta;
        AxaptaRecord axaptaRecord;

        List<Vendor> vendors = new List<Vendor>();

        public void Submit(Vendor vendor)
        {

            axapta = new Axapta();
            axapta.Logon(null,null, null, null);
            using (axaptaRecord = axapta.CreateAxaptaRecord("IDS_Pelajar"))
            {
                axaptaRecord.Clear();
                axaptaRecord.InitValue();
                axaptaRecord.set_Field("TenteraPolisNo", vendor.VendorAccount);
                axaptaRecord.set_Field("Poskod", vendor.InvoiceAccount);
                axaptaRecord.set_Field("Keturunan", vendor.Name); 
                axaptaRecord.Insert();
            }
            axapta.Logoff();
            vendors.Add(vendor);

i already try to add this line of code in app.config

<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

but still it doesn't work.

i have no problem to execute that block of code in console..the exception only pop up when i'm try to execute that block of code in WCF services library

sorry for trouble but i really loss now..Tq 4 help

Firdaus
  • 31
  • 1
  • 5

1 Answers1

0

Check if any of the below help you

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 - Release Build

Handling Mixed Mode Assembly Error in WCF Service Host

Being WCF, I feel the 2nd link might prove useful. The config file for WCF Service host is located at C:\Program Files (x86)Microsoft Visual Studio 10.0Common7IDEWcfSvcHost.exe.config and hence making the change in this config file should fix it.

Hope this helps.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Zahir Khan
  • 35
  • 2
  • 7