Reputation: 36081
I'm getting an error when running xunit.net tasks using MSBuild tasks, as detailed in the xunit wiki: http://xunit.codeplex.com/wikipage?title=HowToUseMSBuild
My MSBuild file is:
<Project
DefaultTargets="Test"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask
AssemblyFile="xunit.runner.msbuild.dll"
TaskName="Xunit.Runner.MSBuild.xunit" />
<ItemGroup>
<TestAssemblies Include="..\**/*.tests.dll" />
</ItemGroup>
<Target Name="Test">
<xunit Assemblies="@(TestAssemblies)" xml="..\TestResults.xml" />
</Target>
</Project>
when I run the msbuild script the build runs successfully and my test results are returned (Test count, failure count etc).
However after displaying the results I get the message to:
C:\Program Files (x86)\Jenkins\jobs\My First Jenkins Build\workspace\src\MyWeb App\Solution Items\xunit.msbuild" (default target) (1) -> (Test target) -> C:\Program Files (x86)\Jenkins\jobs\My First Jenkins Build\workspace\src\MyWe bApp\Solution Items\xunit.msbuild(14,5): error : System.ArgumentException: Coul d not find file: C:\Program Files (x86)\Jenkins\jobs\My First Jenkins Build\wor kspace\src\MyWebApp\MyWebApp.Tests\obj\Debug\xunit.dll C:\Program Files (x86)\Jenkins\jobs\My First Jenkins Build\workspace\src\MyWe bApp\Solution Items\xunit.msbuild(14,5): error : at Xunit.ExecutorWrapper..c tor(String assemblyFilename, String configFilename, Boolean shadowCopy) C:\Program Files (x86)\Jenkins\jobs\My First Jenkins Build\workspace\src\MyWe bApp\Solution Items\xunit.msbuild(14,5): error : at Xunit.Runner.MSBuild.xun it.ExecuteAssembly(String assemblyFilename, String configFilename, IRunnerLogge r logger)
I'm not sure why it's looking for xunit.dll, can anyone shed any light? When I use <xunit Assembly>
rather than <xunit Assemblies>
it works okay.
Upvotes: 2
Views: 1873
Reputation: 36081
The issue that I was having was with my TestAssemblies element, updating it to the following has resolved the issue:
<TestAssemblies Include="..\**\bin\*\*.Tests.dll" />
I think something other my intended 'test' dlls were being picked up, which was causing xunit to look for xunit.dll.
Upvotes: 3