开发者

TFS 2010 Build - registering VB 6.0 DLLs during a build

I have to deploy a classic ASP site through TFS 开发者_如何学JAVA2010. 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.


If you want to do custom tasks with your team build, you can add a node like this to your TFSBuild.proj file. To register a DLL, you could do this:

<Target Name="AfterGet">
    <Exec Command="echo SolutionRoot=$(SolutionRoot)" />
    <Exec Command="regsvr32 /s $(SolutionRoot)\SharedBinaries\STServer.dll" />
</Target>

To get to the TFSBuild.proj file, you can go to source control explorer, and then go under the TeamBuildTypes folder and you should see your build name. Click on that, and in the right pane, you'll see the TFSBuild.proj file (see screenshot below).

TFS 2010 Build - registering VB 6.0 DLLs during a build


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜