Filter only MSTest projects from solution using power shell command

In this article we will discuss about how to filter the test projects from a given solution using power shell commands.

Sometimes we may need to target only test projects to build / running test cases.

Example :






Here our target is to fetch only test projects i.e., ProjectA.Test and ProjectB.Test

For this, we try few commands in power shell.

To Fetch

PS> Get-ChildItem -include "*.Test.csproj" -recurse | where { $_.Name -eq "*.csproj"} | %{$_.Name}

To Build

PS> Get-ChildItem -include "*.Test.csproj" -recurse | where { $_.Name -eq "*.csproj"} | %{dotnet build $_.Name}

To run test methods

PS> Get-ChildItem -include "*.Test.csproj" -recurse | where { $_.Name -eq "*.csproj"} | %{dotnet test $_.Name}

Note : Try above commands at power shell prompt.

Labels: filter test projects power shell, build test projects power shell, build ms test projects power shell, get only test projects power shell


Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker