6

After doing some code refactoring, my VS2010 VB.Net Web Application project has stopped compiling with the following error:

"Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

In the 'File' column of the Visual Studio's error list is the word 'SGEN', but when I double-click, the file does not exist ("The document cannot be opened. It has been renamed, deleted or moved.") I gather it has something to do with serialization, but what is the required additional configuration information? I've spent a few hours researching the error, and everyone says to add the following to the configuration tab of an app.config file:

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

However, I've added this to every config file I could find or create, and so far it hasn't helped.

I suspect part of the problem might be Crystal Reports, the DLLs for which are indeed built against v1.1.4322 of dot net.

To which config file am I supposed to add the legacyRuntime configuration? Is that even the correct solution?

pabrams
  • 1,157
  • 10
  • 34

1 Answers1

9

I got the project to compile by changing 'Generate Serialization Assemblies' from 'Auto' to 'Off' in my app's configuration. The advice all over the internet about useLegacyV2RuntimeActivationPolicy seemed to be a red herring for my situation.

pabrams
  • 1,157
  • 10
  • 34
  • Where is this app configuration found? – Saher Ahwal Jun 11 '12 at 17:02
  • 4
    Probably depends on what version of Visual Studio you're using, but for me (VS2010 Pro) it was Right-Click Project -> hit Properties -> Compile -> Advanced Compile Options... -> Generate serialization assemblies is a dropdown. – pabrams Jun 12 '12 at 17:59
  • You are the F***** man!!!! "Probably depends on what version of Visual Studio you're using, but for me (VS2010 Pro) it was Right-Click Project -> hit Properties -> Compile -> Advanced Compile Options... -> Generate serialization assemblies is a dropdown." WAS KEY!!! – J.S. Orris Mar 24 '15 at 19:10
  • This worked for me with Visual Studio 2017. Thanks @pabrams – Amivit Aug 17 '18 at 08:39