Using with TFS Team Build - Problem with CreateCabDDF.vbs


If you build this WSP project locally on a development PC all is fine. However (depending upon you project) it may fail on Team Build, well actually not fail just pause forever. This due to the way that Team Build checks out folders. The WSP project has a folder structure you drop files in that the VBScript files scan to create the manifest and then the WSP. If one of these directories is empty then it is not created on the build box and the VBScript stalls.
The solution is simply just add an extra folder exists check in the CreateCabDDF.vbs file’s EnumFolder method
sub EnumFolder(sFolder, sRelativePath)
dim oFolder, oFolders, oSub, oFile

rem this is the extra line
If oFS.FolderExists(sFolder) Then
    set oFolder = oFS.GetFolder(sFolder)

    if (sRelativePath = "TEMPLATE") then sRelativePath = ""
    if (sRelativePath = "FEATURES") then sRelativePath = ""

    if (sRelativePath <> "") then sRelativePath = sRelativePath + "\"

    for each oFile in oFolder.Files
        oDDF.WriteLine """" + oFile.Path + """" + vbTab + """" + sRelativePath + oFile.Name + """"
    if (sRelativePath <> "" and InStr(1, sFolder, "FEATURES") > 0) then
        sRelativePath = "FEATURES\" + sRelativePath
    end if
   for each oSub in oFolder.SubFolders
        EnumFolder oSub.Path, sRelativePath + oSub.Name

  end if
end sub
For more detail see (http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2008/12/19/tfs-teambuild-and-sharepoint-wsp-deployment-and-any-post-build-events-for-that-matter.aspx)