用于在 Mono 和 .NET 之间拆分的编译器 #if 指令 [英] Compiler #if directive to split between Mono and .NET

查看:13
本文介绍了用于在 Mono 和 .NET 之间拆分的编译器 #if 指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为 Mac 上的 Mono 和 PC 上的 .NET 双重编译一个类库.我想做一些小改动,但我希望使用编译器指令拆分代码.有什么建议吗?

I need to dual-compile a class library for Mono on the Mac and .NET on the PC. There are some minor changes I want to make, but I was hoping to split the code using a compiler directive. Any suggestions?

推荐答案

你当然可以使用

#if MONO

然后编译

gmcs -define:MONO ...

(当然,或者将它放在您的 Mono 构建配置中.这实际上取决于您构建库的方式.)

(Or put it in your Mono build configuration, of course. It really depends on how you're building your library.)

...除此之外,您还在寻找什么?

... what are you looking for beyond that?

这篇关于用于在 Mono 和 .NET 之间拆分的编译器 #if 指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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