Compilation Failed when building sln2008 with NUnit tests.What am I doing wrong?

I am trying to build a project that has a reference to NUnit for tests. The project builds fine within Visual Studio but does not via TeamCity.  We get the error;

error CS0246: The type or namespace name 'NUnit' could not be found (are you  missing a using directive or an assembly reference?)

I have placed  NUnit.Framework.dll (2.4.7) in the GAC on the build agent and also tried including it within the SVN repository but still get the same error. Im not sure if this problem is specific to NUnit or whether I would have the same problem referecing any external dlls. How can I get this to work?

Any help would be greatly appreciated as Ive spent hours on this to no avail


Comment actions Permalink

Could you please check you reference the same .dll as you put to GAC for all projects in your solution.

Please try the following:
stop build agent service
log in to build agent's machine under build agent service account
run msbuild from the build working directory.

Please check hintPath element value from <reference> element under you .csproj files. What path does it use?

Does that work?

BTW. Please check build agent service is not running under LOCAL_SYSTEM account.

Comment actions Permalink

Its now working!!

I could not the project to build when referencing a third party dll in the GAC.

I abondoned that idea and so i added the assembly into svn and retried the hint path and hey presto, the project now compiles. Now i get an additional ignored result, which i can live with.



PS. Running the build agent service under the local system account didnt cause me any problems. I have changed it to run under a dedicated user account now though as per your recommendations.


Please sign in to leave a comment.