Skip to content

Instantly share code, notes, and snippets.

@dasMulli
Last active January 18, 2021 16:55
Show Gist options
  • Save dasMulli/6fb5d1f507b886aeebaf27069f47f895 to your computer and use it in GitHub Desktop.
Save dasMulli/6fb5d1f507b886aeebaf27069f47f895 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>
@dasMulli
Copy link
Author

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

@joaoportela
Copy link

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