1

I have a .NET solution set up that has the main ASP MVC project and then a class library project that has had NUnit added to it for unit tests.

When I build the solution in TeamCity the main project builds fine but then when the test project builds I get these errors

error BC30002: Type 'TestFixture' is not defined. 
error BC30002: Type 'Test' is not defined. 
error BC30389: 'System.Diagnostics.Assert' is not accessible in this context because it is 'Friend'. 

I assume it can't find the NUnit.dll or something but the dll is in the solution packages folder. I've tried doing package restore first in case it was that but it still did the same.

Update Ok, just to test it I added Moq to the project to see if it would pick up the references. It did and worked fine, it seems to be only problem when I try to use NUnit functions. I could disable it from building but surely the NUnit tests won't be picked up in Team City?

Thanks!

Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
  • what if you open the project on the build server? does the reference exist? – Sam Holder May 21 '15 at 14:19
  • Visual Studio isn't installed on the server it's just using build tools Edit: Forgot you could just open them in notepad, yes the reference is there to the packages folder with the dll – Scott Bamforth May 21 '15 at 14:35
  • 2
    How are you doing the nuget package restore. Is this using the flag in the .csproj or do have an explicit build step to restore packages from the solution using the NuGet Installer build runner? Can you confirm that the package has been downloaded by looking the the Packages Tab in TeamCity? – Matt May 21 '15 at 16:20
  • It's a build step in Team City, and its in the packages tab yeah. I thought maybe some build stuff was missing of the server but I've definitely copied everything across. Could it be to do with NUnit originally being built in .NET 2.0? As this isn't on the server as we only build .NET 4 projects – Scott Bamforth May 21 '15 at 16:24
  • No, that shouldn't be an issue. I've not seen this before so I don't know what to suggest bar making MSBuild output really verbosely at Diagnostic level. Try passing in v:diag as an additional parameter and see if that can help you hunt it down. – Matt May 21 '15 at 19:11

1 Answers1

0

Finally fixed the issue and it was my own stupid mistake. Thanks to DevOps for suggesting going through the MSBuild logs, it helped my track down the problem.

The actual DLL wasn't getting checked in to source control because the dev machine that added the test project had a global ignore file to ignore all DLL's. So I thought it was there but it was just the .xml file and I mis read it.

Anyway it now builds and runs the tests.

Thanks for the help everyone