MissingMethodException when migrating from F# 3.0 to F# 3.1
If you retarget an F# 3.0 project to F# 3.1 in Visual Studio 2013, you might end up with a System.MissingMethodException when you rebuild and run your project. This is because you need to manually update the App.config
file after you retarget to F# 3.1.
In your App.config
, you’ll probably find a runtime
tag looking something like this:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" /> <bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" /> <bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" /> </dependentAssembly> </assemblyBinding> </runtime>
The version numbers are the culprits and you need to change all occurences of newVersion
to "4.3.1.0"
, which is the version number of the F# 3.1 FSharp.Core runtime DLL. You also need to add a redirect from version 4.3.0.0 to 4.3.1.0. The resulting runtime tag should now be:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.1.0" /> <bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.1.0" /> <bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.1.0" /> <bindingRedirect oldVersion="4.3.0.0" newVersion="4.3.1.0" /> </dependentAssembly> </assemblyBinding> </runtime>
Rebuild, rerun and enjoy the absence of MissingMethodExceptions. And that, ladies and gentlemen, is how we do that!
No comments yet.