Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declare preprocesor symbol (like DEBUG) globally for whole project

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

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.

like image 851
Steve Avatar asked Mar 28 '09 10:03

Steve


1 Answers

Use the project properties dialog. You can define global symbols there:

Right click on the project -> Properties -> Build tab -> Conditional compilation symbols

like image 191
mmx Avatar answered Sep 20 '22 10:09

mmx