Using the F # library in a C # project in Xamarin

I have a solution in Xamarin Studio with a C # console program that is trying to call the F # library.

The link is beautiful, everything builds.

My F # code is as follows:

namespace MyStore.Library module public Lookup = open System let lookup name (age:int) = String.Format("{0}, {1}", name, age.ToString() ); 

I can call the F # library from the F # console and the C # library from the C # console, but I cannot mix them.

The C # console does not see the F # namespace at all.

What am I doing wrong?

What should I do to see the F # namespace from C #?

+5
source share
1 answer

In a C # project, you need to add a link to your F # project.

In the "Solution" area, expand the project and click the gear icon → "Edit Links"

Then go to the Projects tab, check the F # project you want to link to, then click OK.

edit referencesprojects

Also, make sure the goal of the C # and F # project matches the same .NET platform! To verify this, right-click the project, Options → Assembly → General

right click projectstarget

+2
source

Source: https://habr.com/ru/post/1208391/


All Articles