Search code examples
teamcitymspec

Build MSpec test with TeamCity


I am trying to set up TeamCity. Initially, I ran into various issues but after much trial and error, I managed to perform a successful build. So I know that I can get a cut down version of my solution to build successfully.

However, one of the items that was problematic was my MSpec test. When I configured my solution to build the MSpec test project I get the following erro:

Areas\Manufacturing\Controllers\DashboardControllerSpecs.cs(7, 30): error CS0234: The type or namespace name 'Hosts' does not exist in the namespace 'CompanyName.ApplicationName' (are you missing an assembly reference?)

The fact is that it builds "fine" on my local machine but on the build server, which happens to be on my local machine, I get the error above.

What could I be doing wrong? What are the things that I should be checking to find out what I'm doing wrong?


Solution

  • Ok,

    I think I've found what I was doing wrong. Effectively, we were doing version numbering in the MSBuild file. The target name was specified as "BeforeBuild". To get TeamCity to build this, I ended up changing this to "Build". The end result was that without the Spec project, TeamCity was building this fine but had trouble with it when the Spec project was included in the build.

    I don't know enough to even speculate why this was happening. However, the solution was to remove the section in the MSBuild file and let TeamCity manage version numbering.