TFS 2010 Build - 在构建期间注册 VB 6.0 DLL

发布于 2024-10-10 01:37:05 字数 113 浏览 0 评论 0原文

我必须通过 TFS 2010 部署一个经典的 ASP 站点。该站点有许多自定义 VB 6.0 DLL,需要在部署过程中取消注册并重新注册。有办法做到这一点吗?这是我第一次通过 TFS 使用构建过程,所以这有点新。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨洒年华 2024-10-17 01:37:05

如果您想在团队构建中执行自定义任务,您可以将这样的节点添加到 TFSBuild.proj 文件中。要注册 DLL,您可以执行以下操作:

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

要访问 TFSBuild.proj 文件,您可以转到源代码管理资源管理器,然后转到 TeamBuildTypes 文件夹下,您应该会看到您的构建名称。单击该文件,在右侧窗格中,您将看到 TFSBuild.proj 文件(请参见下面的屏幕截图)。

替代文字

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).

alt text

顾挽 2024-10-17 01:37:05

好吧,我解决了这个问题,尽管不完全是在 TFS 构建过程中。我正在做的是,构建过程完成后,我运行 MS Deploy 脚本,该脚本将 TFS 发布的文件复制到远程服务器。然后,在部署文件后,我调用另一个 msdeploy 命令来运行已添加到项目中的 VBScript 文件。 VBScript 代码循环遍历项目并重新注册它找到的所有 DLL。

以下是在批处理文件中调用的 MS Deploy 脚本:

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

最后是注册 DLL 的 VBScript 文件:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文