I have to deploy a classic ASP site through TFS 2010. This site has many custom VB 6.0 DLLs that need to be unregistered and re-registered during the deployment process. Is there a way to do this? This is my first experience using the build process through TFS, so it's all a bit new.
Well, I sort of solved the problem, though not exactly in the TFS build process. What I am doing is, after the build process is complete, I run an MS Deploy script, and that script copies the files that have been published by TFS to a remote server. Then, after the files have been deployed, I call another msdeploy command that runs a VBScript file that has been added to the project. The VBScript code loops through the project and re-registers all the DLLs it find.
Here are the MS Deploy scripts, called in a batch file:
msdeploy -verb:sync -source:contentpath=C:\temp\Build\_PublishedWebsites\TestSite -dest:contentPath=D:\Inetpub\wwwroot\TestSite,computername=RemoteSystem:1111
msdeploy -verb:sync -source:runcommand="D:\Inetpub\wwwroot\TestSite\RegisterFiles.vbs",waitinterval=10000 -dest:auto,computername=RemoteSystem:1111
Finally, the VBScript file that registers the DLLs:
Set oShell = CreateObject ("WScript.Shell")
Dim FSO, FLD, FIL
Dim strFolder, strPath
strFolder = "D:\Inetpub\wwwroot\TestSite\DLLs\"
'Create the filesystem and folder objects
Set FSO = CreateObject("Scripting.FileSystemObject")
set FLD = FSO.GetFolder(strFolder)
'Loop through the DLLs in the folder
For Each Fil In FLD.Files
If Instr(Fil.Name,".dll") Then
strPath = strFolder & Fil.Name
oShell.Run "regsvr32 /s /u " & strPath
oShell.Run "regsvr32 /s " & strPath
End If
Next
If isObject(oShell) Then
Set oShell = Nothing
End IF
Set FLD = Nothing
Set FSO = Nothing