2

I've got a problem when launching a Canopy test in a Windows box:

Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft
.FSharp.Core.FSharpFunc`2<System.String,System.String> canopy.core.get_xpath()'.
at <StartupCode$UITest>.$Program.main@()

I guess this is because when compiling it, my Visual Studio 2012 restored Nuget packages and spitted this in the console output:

Consider app.config remapping of assembly "FSharp.Core, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.3.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0\FSharp.Core.dll] to Version "4.4.0.0" [C:\Users\Andres\Documents\Code\endtoendtests\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll] to solve conflict and get rid of warning.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\fsc.exe -o:obj\x86\Debug\UITest.exe -g --noframework --define:DEBUG --optimize- --tailcalls- --platform:x86 -r:C:\Users\Andres\Documents\Code\endtoendtests\packages\canopy.0.9.52\lib\canopy.dll -r:C:\Users\Andres\Documents\Code\endtoendtests\packages\FSharp.Core.4.0.0.1\lib\net40\FSharp.Core.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Numerics.dll" -r:C:\Users\Andres\Documents\Code\endtoendtests\packages\Selenium.WebDriver.2.53.0\lib\net40\WebDriver.dll --target:exe --warnaserror:76 --vserrors --validate-type-providers --LCID:1033 --utf8output --fullpaths --flaterrors --highentropyva- "C:\Users\Andres\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.fs" AssemblyInfo.fs Program.fs 
UITest -> C:\Users\Andres\Documents\Code\endtoendtests\UITest\bin\Debug\UITest.exe

How to exactly add this remapping to fix this problem?

Guy Coder
  • 24,501
  • 8
  • 71
  • 136
knocte
  • 16,941
  • 11
  • 79
  • 125
  • Possible duplicate of [MissingMethodException when testing a function that takes a function parameter](http://stackoverflow.com/questions/36238316/missingmethodexception-when-testing-a-function-that-takes-a-function-parameter) – Mark Pattison Apr 14 '16 at 06:36
  • 1
    Possible duplicate of ["Consider app.config remapping of assembly ..." warning in F#](http://stackoverflow.com/questions/7951560/consider-app-config-remapping-of-assembly-warning-in-f) – knocte Apr 14 '16 at 07:11
  • For others who find this. `MisingMethodException` is so common it has it's own [tag](http://stackoverflow.com/questions/tagged/missingmethodexception). Please read these other [answers](http://stackoverflow.com/questions/tagged/missingmethodexception+f%23) before asking a new one. – Guy Coder Apr 14 '16 at 11:09
  • Also look at F# [questions](https://stackoverflow.com/questions/tagged/f%23+assembly-binding-redirect) related to assembly binding redirect in app.config. – Guy Coder Apr 14 '16 at 11:37

1 Answers1

3

Managed to get it to work with this App.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
        <bindingRedirect oldVersion="4.3.0.0" newVersion="4.4.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

This must be because I've never installed F#, so that I'm using the version that comes with my VS2012 (v3.0). I know I know, I should upgrade to 3.1, or 4.0 even.

knocte
  • 16,941
  • 11
  • 79
  • 125