PDA

View Full Version : VSS History to File


dprice
01-20-2005, 03:07 PM
Hello,

I have a build step based on one of your VSS samples that displays the history based on a label. I would like to save this output into its own text file (in addition to the regular build log). Is there a way to do this?

Thanks in advance!
Derek

kinook
01-20-2005, 04:28 PM
Put the following in the 'Additional command-line options' field on the SourceSafe action's Options tab:

"-O&c:\out.txt"

This will redirect the output to the file specified [1]. Then add the following in the step's script code (Script Editor button | Step tab) to also get the contents logged in the build:

Function vbld_StepDone()
If vbld_FSO.FileExists("c:\out.txt") Then
Builder.LogMessage vbld_GetFileContents("c:\out.txt")
End If
End Function

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/guides/html/vsgrfCmdLine_SwitchO.asp

dprice
01-20-2005, 04:58 PM
Outstanding support and response time!

The VSS history to log is now working, but not the step of injecting the history into build log.

In my case, here's the VSS additional command-line:
-O&%PROJDIR%\F6TesTDotNetPort.root\F6TesTDotNetPort\% BUILD_HISTORY_LOG%

In the Script Editor Step tab, I have this:
Function vbld_StepDone()
If vbld_FSO.FileExists("%PROJDIR%\F6TesTDotNetPort.root\F6TesTDotNetPort\% BUILD_HISTORY_LOG%") Then
Builder.LogMessage vbld_GetFileContents("%%PROJDIR%\F6TesTDotNetPort.root\F6TesTDotNetPort\ %BUILD_HISTORY_LOG%")
End If
End Function

Any idea why it's not firing the StepDone call?

Thanks!
Derek

kinook
01-20-2005, 05:08 PM
Macros (%name%) aren't expanded in step script code. Change the code in the script event to

Function vbld_StepDone()
fname = Application.ExpandMacrosAndScript("%PROJDIR%\F6TesTDotNetPort.root\F6TesTDotNetPort\% BUILD_HISTORY_LOG%")
If vbld_FSO.FileExists(fname) Then
Builder.LogMessage vbld_GetFileContents(fname)
End If
End Function


See http://www.visualbuild.com/Manual/?scripteditor.htm for more details.

dprice
01-20-2005, 05:25 PM
That was it! Thanks for all the help.
Derek