是否可以在单个Visual Studio Windows控制台项目中混合.cs(C#)和.fs(F#)文件? (。净) [英] Is it possible to mix .cs (C#) and .fs (F#) files in a single Visual Studio Windows Console Project? (.NET)
问题描述
如何做到?
在不使用分离的dll文件或项目的情况下,可以将一个函数从一个F#代码调用到C#中。
How to do it? Is it possible to call a function from one F# code into C# without using a separated dll file or project?
推荐答案
您不能在同一个项目中包含两种不同的语言,但您可以使用 ilmerge 。为此,将两个项目放在同一个解决方案,并引用F#模块,就像任何dll。作为部署脚本的一部分,运行ilmerge将exe文件和dll文件合并到一个exe文件中。请参阅此代码项目文章,详细了解如何使用ilmerge创建exe。
You can't include two different languages in the same project, but you can merge them using ilmerge. To do this, put both projects in the same solution and reference the F# module as you would any dll. As part of your deployment script, run ilmerge to combine the exe file and dll file into a single exe file. See this Code Project article that details how to use ilmerge to create an exe.
这篇关于是否可以在单个Visual Studio Windows控制台项目中混合.cs(C#)和.fs(F#)文件? (。净)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!