是否可以在单个 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)

查看:15
本文介绍了是否可以在单个 Visual Studio Windows 控制台项目中混合 .cs (C#) 和 .fs (F#) 文件?(.网)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么做?是否可以在不使用单独的 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.为此,请将两个项目放在同一个解决方案中,并像引用任何 dll 一样引用 F# 模块.作为部署脚本的一部分,运行 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆