简体   繁体   English

在Android项目中引用F#代码

[英]Referencing F# code in android project

I'm doing a project where i am supposed to write an android application that uses a code-base of f# code. 我正在做一个项目,我应该编写一个使用f#代码代码库的android应用程序。 In doing so i am running into some problems regarding referencing this f# code in my android project. 在这样做时,我遇到了一些有关在我的android项目中引用此f#代码的问题。

I've been googling and it tells me that the f# code has to be in a PCL project that is referenced by the android project. 我一直在谷歌搜索,它告诉我f#代码必须在android项目引用的PCL项目中。 I've done this, but the android project is still not able to recognise the namespaces and files declared in the other project. 我已经做到了,但是android项目仍然无法识别其他项目中声明的名称空间和文件。

I have a namespace called NimGame.Core where most of my .fs files are located. 我有一个名为NimGame.Core的命名空间,大多数我的NimGame.Core文件都位于该命名空间。 An example are shown in the picture below of my event queue module that is clearly located in NimGame.Core. 下图显示了我的事件队列模块的一个示例,该模块显然位于NimGame.Core中。 IT can also be seen in my references that i have referenced the PCL project (NimGameCore) in my android project (NimGame). 在我的参考资料中也可以看到它,在我的android项目(NimGame)中引用了PCL项目(​​NimGameCore)。 fsharp代码示例

But when i am trying to use the fsharp files in my c# code it doesn't show up. 但是,当我尝试在我的C#代码中使用fsharp文件时,它没有显示。 例2

Any suggestions as to what can be causing this? 关于什么可能导致此的任何建议?

There was a bug in Xamarin Studio and MonoDevelp which prevented IntelliSense from working when F# project was referenced from C# project. Xamarin StudioMonoDevelp中存在一个错误,当从C#项目中引用F#项目时,IntelliSense无法正常工作。 Additionally, F# types in C# code were underlined with red line. 此外,C#代码中的F#类型用红线下划线。

The bug was fixed, so upgrading you IDE should solve the problem. 该错误已修复,因此升级IDE应该可以解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM