Skip to content

Instantly share code, notes, and snippets.

@abenedykt
Created February 20, 2014 19:10
Show Gist options
  • Save abenedykt/9120999 to your computer and use it in GitHub Desktop.
Save abenedykt/9120999 to your computer and use it in GitHub Desktop.
msmuild for build a solution and run xunit tests
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WorkingFolder>$(MSBuildProjectDirectory)</WorkingFolder>
<Configuration>Release</Configuration>
<SolutionFile>WebApplication1.sln</SolutionFile>
</PropertyGroup>
<Target Name="BuildAll" DependsOnTargets="Compile;Test" />
<Target Name="Compile">
<Message Text="=== COMPILING $(Configuration) configuration ===" />
<MSBuild Projects="$(SolutionFile)"
Properties="Configuration=$(Configuration)" />
</Target>
<UsingTask AssemblyFile="packages\xunit.1.9.2\lib\net20\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit"/>
<ItemGroup>
<TestAssemblies
Include="**\bin\$(Configuration)\*test*.dll" />
</ItemGroup>
<Target Name="Test">
<Message Text="=== Running unit tests : $(Configuration) configuration ===" />
<xunit
Assemblies="@(TestAssemblies)"
Xml="..\TestResults-$(PROCESSOR_ARCHITECTURE).xml"
Html="..\TestResults-$(PROCESSOR_ARCHITECTURE).html" />
</Target>
</Project>
@abenedykt
Copy link
Author

cmd

.\MSBuild "path.to.msbuild\project.build" /t:BuildAll /p:Configuration=Release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment