Skip to content

Instantly share code, notes, and snippets.

@sayedihashimi
Created July 28, 2014 21:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sayedihashimi/c1cf2bfafaec597793e4 to your computer and use it in GitHub Desktop.
Save sayedihashimi/c1cf2bfafaec597793e4 to your computer and use it in GitHub Desktop.
msbuild get elapsed time
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This shows how you can calculate the elapsed time in MSBuild
-->
<Target Name="BeforeBuild">
<PropertyGroup>
<startTime>$([System.DateTime]::Now)</startTime>
</PropertyGroup>
</Target>
<Target Name="AfterBuild">
<PropertyGroup>
<elapsed>$([System.DateTime]::Now.Subtract($(startTime)))</elapsed>
</PropertyGroup>
<Message Text="elapsed: $(elapsed)" Importance="high"/>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment