C#中:声明preprocesor符号(如调试)globaly为整个项目 [英] C#: Declare preprocesor symbol (like DEBUG) globaly for whole project
本文介绍了C#中:声明preprocesor符号(如调试)globaly为整个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想是这样的NUnit和VS测试之间进行切换:
I would like to switch between NUnit and VS Tests like this:
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using TestContext = System.String;
using DeploymentItem = NUnit.Framework.DescriptionAttribute;
#endif
我的问题是,我怎么可能会宣布NUNIT preprocesor符号在一个地方(App.config中左右,将是巨大的),到NUnit的和VSTests轻松地之间进行切换?因为当我使用#定义NUNIT,它只能为文件,它被写入。
My question is, how may I declare NUNIT preprocesor symbol at one place (App.config or so, would be great), to switch between NUnit and VSTests easily? Because when I use "#define NUNIT", it works only for the file, where it is written.
推荐答案
使用项目属性对话框。您可以定义全局符号有:
Use the project properties dialog. You can define global symbols there:
右键单击项目 - >属性 - >生成选项卡 - >条件编译符号
Right click on the project -> Properties -> Build tab -> Conditional compilation symbols
这篇关于C#中:声明preprocesor符号(如调试)globaly为整个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文