Additional configuration to reference .NET 4.0?

2

Today when I tried to publish a new version of my application, the following error appeared:

  

Error 26 Mixed mode assembly is built against version 'v2.0.50727' of   the runtime and can not be loaded in the 4.0 runtime without additional   configuration information.

I've never had this error before, as I have not added new dll's in the application, I do not understand the source of the error. However I have done several searches with possible solutions, but at the time of complicating it always returns the same error.

Following this solution , I already tried to add

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

 in my Web.config , but always with the same error.

Or following this solution between the various answers, I could never solve the error.

What might have caused the error? How can I fix it?

EDIT I found that this error occurs when I add an external service to my application (Web Reference), and that without the service this error does not occur. When integrating the service into the application the Web.config changes, maybe that's where the error is?

<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="MvcTesteLayout.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
...

<applicationSettings>
    <MvcTesteLayout.Properties.Settings>
      <setting name="MvcTesteLayout_com_frotasoft_www_API" serializeAs="String">
        <value>http://www.frotasoft.com/FrotaSoftGeo/Services/API.asmx</value>
      </setting>
    </MvcTesteLayout.Properties.Settings>
  </applicationSettings>
    
asked by anonymous 15.12.2014 / 15:50

1 answer

1

Try to mount Web.config with both runtimes :

<configuration>
  ...
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
  ...
</configuration>
    
16.12.2014 / 16:18