[ACCEPTED]-Can Visual Studio put timestamps in the build log?-build

Accepted answer
Score: 37

Other option is to increase level of MSBuild 2 verbosity.

Tools -> Options -> Projects and Solutions -> Build and Run -> 

Set MSBuild project build output verbosity to Normal. That will give you output 1 like this:

------ Build started: MyProject, Configuration: Debug x86 ------
Build started 24/03/2014 08:46:18.
...
Build succeeded.

Time Elapsed 00:00:05.18
Score: 13

For VC++ builds you can enable build timing. Go 3 to Tools->Options->Projects and Solutions->VC++ Project 2 settings and choose the option for 'Build 1 Timing'

Score: 9

A new way I found is to call the Time command 1 in the post event Pre and Post-build event command line:

TIME /T
Score: 0

Not without modifying the actual project 2 file (using a text editor) to add calls 1 in to the MSBuild script targets.

Score: 0

Alternate solution with script file... Also 10 includes Elapsed Time for the build for 9 a project.

Create VBS file somewhere in your 8 projects shared space "GetTime.vbs" VBS 7 Code ...

dim out : Set out = WScript.StdOut
Set objShell = WScript.CreateObject("WScript.Shell")
dim regDir: regDir="HKEY_CURRENT_USER\Software\VB and VBA Program Settings\GetTime.vbs\"
dim msg: msg=""
dim s: s=""
dim e: e=""
dim st:st=""
' param s is start flag keyed to the application being built.
if wscript.arguments.named.exists("s") then
    s = wscript.arguments.named("s")
    objShell.RegWrite regdir & s,now
end if
if wscript.arguments.named.exists("e") then
    e = wscript.arguments.named("e")
    st = cdate(objShell.RegRead(regDir & e))
end if 

if e<>"" and isdate(st) then
    out.writeline e & " ENDED " & now & " ELAPSED " & datediff("s",cdate(st),now) & " seconds"
elseif e<>"" then
    out.writeline e & " ENDED " & now
elseif s<>"" then
    out.writeline s & " STARTED " & now
else
    out.writeline now
end if 

Alter you Build Events to include 6 this script with some parameters as such... (You 5 will need to alter the direcotry path relative 4 to your output directory to find the file 3 from multiple projects)

Prebuild Event Command 2 Line ...

cscript "../../../../Scorecards/gettime.vbs" //B /s:"$(ProjectName)"

Post Build Event Command Line

cscript "../../../../Scorecards/gettime.vbs" //B /e:"$(ProjectName)"

Example 1 output from multiple projects ...

2>  OPResources STARTED 7/9/2020 12:59:04 PM
2>  ...
2>  OPResources ENDED 7/9/2020 12:59:05 PM ELAPSED 1 seconds
1>  OPLib_WF STARTED 7/9/2020 12:59:04 PM
1>  ...
1>  OPLib_WF ENDED 7/9/2020 12:59:05 PM ELAPSED 1 seconds
4>------ Rebuild All started: Project: OPLib, Configuration: Debug Any CPU ------
4>  OPLib STARTED 7/9/2020 12:59:06 PM
4> ...
4>  OPLib ENDED 7/9/2020 12:59:10 PM ELAPSED 4 seconds
5>------ Rebuild All started: Project: PerfUpdater, Configuration: Debug Any CPU ------
6>------ Rebuild All started: Project: Scorecards2, Configuration: Debug Any CPU ------
7>------ Rebuild All started: Project: SingleSignOn, Configuration: Debug Any CPU ------
7>  SingleSignOn STARTED 7/9/2020 12:59:10 PM
7>  ...
7>  SingleSignOn ENDED 7/9/2020 12:59:12 PM ELAPSED 2 seconds

More Related questions