0
votes

I have a library project called MyLib, in which I have a namespace called Extensions, in which there is a module called Extension1, which has a method called ext1Method1 of type string -> string.

In the solution for the library project, there is an executable console project called Test. Within Test I can call MyLib.Extensions.Extension1.ext1Method1 str and it works fine.

I have created a completely separate solution called NewSol1 and included a reference to MyLib.dll in NewSol1. In NewSol1 there is a line

printfn "%s" (MyLib.Extensions.Extension1.ext1Method1 "Hello, World")

The solution NewSol1 builds without any error. But when I run the executable I get the following error:

System.MissingMethodException was unhandled

Message: An unhandled exception of type 'System.MissingMethodException' occurred in NewSol1.exe

Additional information: Method not found: 'Microsoft.FSharp.Collections.FSharpList`1<System.String> MyLib.Extensions.Extension1.ext1Method1(System.String)'.

Thanks in advance for your help.

1
@ildjarn That solved the problem! If you post the link as an answer, I will accept it. - Shredderroy

1 Answers

3
votes

I'm posting a succinct answer here even though the link provided by ildjarn answers the question: to fix the problem, ensure that the Nuget packages in the two solutions are the same.

In my case, the library used a slightly older version of FSharp.Core. Since I had the freedom to recompile the library against any version of FSharp.Core, I chose to update all the Nuget packages in both the library and the consumer. I did this by right-clicking the library solution, choosing Manage Nuget Packages for Solution... and making sure all of the packages were up-to-date.