2016-03-11 22:18:27 +03:00
|
|
|
# Building NUnit 3.0
|
2012-01-25 02:48:58 +04:00
|
|
|
|
2014-11-27 05:22:46 +03:00
|
|
|
NUnit 3.0 consists of three separate layers: the Framework, the Engine and the Console Runner.
|
|
|
|
The source code is kept in a single GitHub repository at http://github.com/nunit/nunit.git.
|
|
|
|
|
2016-03-11 20:32:56 +03:00
|
|
|
Note that assemblies in one layer must not reference those in any other layer, except as follows:
|
|
|
|
* The console runner references the nunit.engine.api assembly, but not the nunit.engine assembly.
|
|
|
|
* Tests in any layer reference nunit.framework.
|
|
|
|
Developers should make sure not to introduce any other references.
|
|
|
|
|
|
|
|
There are two ways to build NUnit: using the solution file in an IDE or through the build script.
|
|
|
|
|
2016-03-11 22:18:27 +03:00
|
|
|
## Solution Build
|
2016-03-11 20:32:56 +03:00
|
|
|
|
2014-11-27 05:22:46 +03:00
|
|
|
All three layers are built together using a single Visual Studio solution (nunit.sln on Windows
|
2015-02-04 05:49:54 +03:00
|
|
|
and nunit.linux.sln on Linux), which may be built with Visual Studio 2012+, SharpDevelop.
|
2014-11-27 05:22:46 +03:00
|
|
|
or MonoDevelop.
|
|
|
|
|
|
|
|
There is a separate VS2008 solution for building the framework to run under the .NET
|
|
|
|
compact framework 3.5.
|
|
|
|
|
|
|
|
The solutions all place their output in a common bin directory. Console runner and engine
|
|
|
|
components are placed directly in the bin directory while framework components end up in
|
2015-02-24 20:30:49 +03:00
|
|
|
subdirectories net-2.0, net4.0, sl-5.0, portable and netcf-3.5. Future platform
|
2014-11-27 05:22:46 +03:00
|
|
|
builds will cause new subdirectories to be created.
|
|
|
|
|
2016-03-11 22:18:27 +03:00
|
|
|
## Build Script
|
2014-11-27 05:22:46 +03:00
|
|
|
|
2016-03-18 21:39:27 +03:00
|
|
|
We use **Cake** (http://cakebuild.net) to build NUnit for distribution. The primary script that controls
|
2016-03-11 20:32:56 +03:00
|
|
|
building, running tests and packaging is build.cake. We modify build.cake when we need to add new
|
|
|
|
targets or change the way the build is done. Normally build.cake is not invoked directly but through
|
2016-03-11 23:03:46 +03:00
|
|
|
build.ps1 (on Windows) or build.sh (on Linux). These two scripts are provided by the Cake project
|
2016-03-11 20:32:56 +03:00
|
|
|
and ensure that Cake is properly installed before trying to run the cake script. This helps the
|
|
|
|
build to work on CI servers using newly created agents to run the build and we generally run it
|
|
|
|
the same way on our own machines.
|
|
|
|
|
|
|
|
The build shell script and build.cmd script are provided as an easy way to run the above commands.
|
|
|
|
In addition to passing their arguments through to build.cake, they can supply added arguments
|
|
|
|
through the CAKE_ARGS environment variable. The rest of this document will assume use of these commands.
|
|
|
|
|
|
|
|
There is one case in which use of the CAKE_ARGS environment variable will be essential, if not necessary.
|
|
|
|
If you are running builds on a 32-bit Windows system, you must always supply the -Experimental argument
|
|
|
|
to the build. Use set CAKE_ARGS=-Experimental to ensure this is always done and avoid having to type
|
|
|
|
it out each time.
|
|
|
|
|
|
|
|
Key arguments to build.cmd / build:
|
2016-03-11 22:18:27 +03:00
|
|
|
* -Target, -t <task> The task to run - see below.
|
|
|
|
* -Configuration, -c [Release|Debug] The configuration to use (default is Release)
|
|
|
|
* -Experimental, -e Use the experimental build of Roslyn
|
2016-03-11 20:32:56 +03:00
|
|
|
|
|
|
|
The build.cake script contains a large number of interdependent tasks. The most
|
|
|
|
important top-level tasks to use are listed here:
|
2016-03-12 21:46:28 +03:00
|
|
|
|
|
|
|
```
|
2016-03-11 20:32:56 +03:00
|
|
|
* Build Builds everything. This is the default if no target is given.
|
|
|
|
* Rebuild Cleans the output directory and builds everything
|
2016-03-11 23:03:46 +03:00
|
|
|
* Test Runs all tests. Dependent on Build.
|
2016-03-11 20:32:56 +03:00
|
|
|
* TestAllFrameworks Runs all framework tests. Dependent on Build.
|
|
|
|
* Test45 Tests the 4.5 framework without building first.
|
|
|
|
* Test40 Tests the 4.0 framework without building first.
|
|
|
|
* Test20 Tests the 2.0 framework without building first.
|
|
|
|
* TestPortable Tests the portable framework without building first.
|
|
|
|
* TestSL Tests the Silverlight framework without building first.
|
|
|
|
* TestCF Tests the compact framework without building first.
|
|
|
|
* TestEngine Runs all engine tests. Dependent on Build.
|
|
|
|
* TestConsole Runs the console tests. Dependent on Build.
|
|
|
|
* Package Creates all packages without building first. See Note below.
|
2016-03-12 21:46:28 +03:00
|
|
|
```
|
2016-03-11 20:32:56 +03:00
|
|
|
|
2016-03-11 22:18:27 +03:00
|
|
|
### Notes:
|
2016-03-11 20:32:56 +03:00
|
|
|
1. By design, the Package target does not depend on Build. This is to allow re-packaging
|
|
|
|
when necessary without changing the binaries themselves. Of course, this means that
|
|
|
|
you have to be very careful that the build is up to date before packaging.
|
|
|
|
|
2016-04-06 22:55:42 +03:00
|
|
|
2. If the compact framework or Silverlight SDK are not installed on a machine, the relevant
|
|
|
|
building and testing tasks are skipped and a warning is issued.
|
2014-11-27 05:22:46 +03:00
|
|
|
|
2016-08-09 20:57:50 +03:00
|
|
|
3. For additional targets, refer to the build.cake script itself.
|