Reputation: 492
I am working on setting a project to use bamboo for CI testing, but have hit a hitch when attempting to compile unit tests. We are using the .NET framework 4.5
and NUnit v2.6.3.13283
. When I am in bamboo, I have set up the specific job to check out the source code when a new commit is pushed, and then use MSBuild
to build the code. Unfortunately, when it reaches this second step, it decides that it no longer understands what NUnit
is.
I have the nunit.framework.dll
in the same directory (bin\Debug) as the class .dll, so I'm definitely confused as to how I should go about having MSBuild
work out building the NUnit
tests.
Any help would be appreciated.
EDIT: Error log for those not faint of heart.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:AnyCPU /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll /reference:"C:\build-dir\UCL-UNL-JOB1\Unit Class Library\bin\Debug\Unit Class Library.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\UnitClassLibraryNUnitTests.dll /target:library AngleNUnitTests.cs "C:\Users\Bamboo\AppData\Local\Temp.NETFramework,Version=v4.5.AssemblyAttributes.cs"
AngleNUnitTests.cs(5,7): error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?) [C:\build-dir\UCL-UNL-JOB1\UnitClassLibraryNUnitTests\UnitClassLibraryNUnitTests.csproj]
AngleNUnitTests.cs(12,10): error CS0246: The type or namespace name 'Test' could not be found (are you missing a using directive or an assembly reference?) [C:\build-dir\UCL-UNL-JOB1\UnitClassLibraryNUnitTests\UnitClassLibraryNUnitTests.csproj]
etc.
Upvotes: 2
Views: 3409
Reputation: 509
I guess you are using NuGet? If so, you need to enable NuGet Package restore, because MSBuild does not know how to resolve these NuGet packages. This will create a .nuget directory in your solution which needs to be pushed the repository bamboo uses for the build.
Second problem I encountered when configuring the NUnit test runner with bamboo: the nunit-console.exe uses .NET Framework 3.5 which was not installed on my build server.
Upvotes: 0
Reputation: 36
When using Nuget with a source code repository, you have a couple of options.
1) check in your nuget executable to source code and create a bamboo command task that calls that location relative to the build directory, ${bamboo.build.working.directory}\tools\Nuget.exe.
2) Install the Nuget exe directly on the build server. Then you can create a new executable on Bamboo that you can reference in any task.
To create a new executable for use in tasks, use this - https://confluence.atlassian.com/display/BAMBOO/Defining+a+new+executable+capability
Upvotes: 0
Reputation: 118
You need to use a previous task to MSBuild one (Maybe you could consider to use the VisualStudio Task it works like a charm).
This previous task is a Command Task, it will update the Dlls related to the NuGet Package, in order to achieve it:
In my approach I am using a VisualStudio task and after this one a MSTest Runner task.
Upvotes: 3