声明preprocesor符号(如调试)全球范围内为整个项目 [英] Declare preprocesor symbol (like DEBUG) globally for whole project
本文介绍了声明preprocesor符号(如调试)全球范围内为整个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想这样的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轻松之间切换?因为当我使用的#define 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
这篇关于声明preprocesor符号(如调试)全球范围内为整个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文