有条件编译整个命名空间 - C# [英] Conditionally compiling entire namespaces - C#

查看:233
本文介绍了有条件编译整个命名空间 - C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有一种方法可以有条件地编译C#整个命名空间。还是我留下了有明确装饰用预处理指令的命名空间中的每一个源文件排除了吗?在我的应用程序的子版本,在不同的命名空间中的代码根本就不是必需的,我想它排除在外。

I was wondering if there is a way to conditionally compile entire namespaces in C#. Or am I left with having to explicitly decorate each source file within the namespace with the preprocessor directives to exclude it? In sub-versions of my application the code in various namespace is simply not required and I would like it excluded.

在此先感谢!

推荐答案

如果您的命名空间是在一个单独的组件,它不包含其他任何你可以使用配置管理器为您具体的分版和取消勾选生成复选框。

If your namespace is in a separate assembly which doesn't contain anything else you can use the Configuration Manager for your specific sub-version and untick the "Build" check box.

如果你有在装配其他类虽然他们不会被建成或纳入明显,然后唯一的办法是用预先装饰处理器声明。

If you've got other classes in the assembly though they will not be built or included obviously, and then the only way would be to decorate with pre-processor declarations.

这篇关于有条件编译整个命名空间 - C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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