Skip to content

Building with msbuild or xbuild

ermshiperete edited this page Jan 29, 2013 · 28 revisions

Building Everything

The basic process to build the entire FieldWorks system (everything a developer needs to run FieldWorks; all that is omitted is installers and localizations) is as follows:

cd to the Build directory (under your root ww directory).

build /t:remakefw

If you don't want to discard everything and start from scratch, you can use

build /t:mkall

to build everything that needs it, based on dependencies.

There are several additional command line arguments that may be helpful:

/property:action=test will run unit tests. At least for everything that is built, possibly more (todo: find out exactly). Look for a section in the output headed "NUnit Summary report:" to see whether all the tests passed.

/property:config=release;Configuration=Release will do a release build.

/m causes the build to do as much as possible in parallel. I've once seen this fail, with different threads contending to write to the same file, but if it works it seems to work right. I thought it could speed things up significantly, but Alistair says nothing much is happening in parallel, and the speedup was probably just more stuff being cached.

/v:m reduces the "verbosity" of the output, suppressing the many warnings our build generates and other stuff...unfortunately including the report of elapsed time for the whole build. A major advantage is that the NUnit summary ends up at the end of the build report.

/ds is interesting to use with /m. It gives a detailed summary of how the different cores were applied to the build task. We can potentially use this to find bottlenecks and optimize the process to be able to use more cores more of the time. Instructions on interpreting it are at here. Gotcha: /v:m totally suppresses the output of /ds.

I've found it quite helpful to redirect the output of the build to a file (>foo.txt). Especially without /v:m, the output is so verbose it can exceed the 9999 line limit of a dos box. Unfortunately you then can't see the progress. There's probably some version of redirection that puts it in both places...if you know please update this.

Build parts

It is also possible to build just one or two projects (and their dependencies; we haven't found the equivalent of "-nodep" in MSBuild yet).

build /t:xworkstests /property:action=test /v:m

to build just the xWorksTests project and its dependencies and run the tests at minimal verbosity.

Then you'll probably want an NUnitReport to see how the tests went, since the test results are scattered through the build output. NUnitReport defaults to minimal verbosity.

nunitreport /a

will grab all the available nUnit output files and run the report, or alternatively you can do:

nunitreport {testproject}

in order to run a report just on one project's tests (e.g. nunitreport discoursetests), or:

nunitreport {testproject} /v:n
nunitreport {testproject} /v:d

for normal and detailed verbosity.

Building on Linux

On Linux you can replace build with xbuild and basically follow the instructions above. A typical sequence to do a complete build would be:

. environ
cd Build
xbuild /t:refreshTargets
xbuild /t:remakefw /p:action=test

Note that you might want to run the tests in a xephyr window so that they you can keep working on other things. You can then start the build with:

DISPLAY=:2 AssertUiEnabled=false xbuild /t:remakefw /p:action=test
Clone this wiki locally