Additional settings for referencing . NET 4.0?

Asked

Viewed 136 times

2

Today when trying 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 cannot be Loaded in the 4.0 Runtime without Additional Configuration information.

Never before had I appeared this error, as I didn’t add new dll’s in the application, I don’t understand the origin of the error. However I have done several searches with possible solutions, but when complicating always returns the same error.

Following this solution, I’ve tried to add

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

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

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

What may have caused the error? How can I resolve 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 happen. When integrating the service into the application Web.config is changed, maybe this is why the error?

<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>
  • Ever tried to put <supportedRuntime version="v2.0.50727"/>?

  • Yes, I’ve tried @viniciushana

  • This error occurs only in the post or appears in development as well?

  • @Ciganomorrisonmendez is only published/run in release mode. I am using a service (Web Reference), and I tested that when publishing my application without the service in the project does not give error, but if you add it gives this error.

  • @Cesarmiguel Is there any transformation in Web.config at the time of publication? I suspect this Web.config is not going with the settings for your server.

  • @Ciganomorrisonmendez, yes changes occur. But I can’t find anything related to v2.0.50727. I will change the question and put the changes of web.config

Show 1 more comment

1 answer

1

Try to assemble the 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>
  • I had already tried and tried again add the runtimes and did not solve. Even in the properties of the project I also put the Generate serialization Assembly to OFF

Browser other questions tagged

You are not signed in. Login or sign up in order to post.