Skip to content

Instantly share code, notes, and snippets.

@lomholdt
Forked from dasMulli/Directory.Build.targets
Created July 21, 2018 11:24
Show Gist options
  • Save lomholdt/dbb140b370ce2fb8730b7df7eaaba002 to your computer and use it in GitHub Desktop.
Save lomholdt/dbb140b370ce2fb8730b7df7eaaba002 to your computer and use it in GitHub Desktop.
Allow `dotnet test` to be run from solution directory
<Project>
<Target Name="VSTest">
<MSBuild Projects="@(ProjectReference)" Targets="VSTestIfTestProject" Properties="%(ProjectReference.AdditionalProperties)" />
</Target>
</Project>
<Project>
<Target Name="VSTestIfTestProject">
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
</Target>
</Project>
@lomholdt
Copy link
Author

For a solution file named any.sln, the targets file containing the VSTest target must be named after.any.sln.targets.

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