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?
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.
来源:https://stackoverflow.com/questions/9772265/mixed-mode-assembly-is-built-against-version-x-and-cannot-be-loaded-in-version-y