我正在尝试使用VS 2015扩展来连接当前使用的tfs。我找到了解决方案
<?php
$con = mysqli_connect("localhost","root","");
mysqli_select_db($con,"simple");
$id=$_POST['id'];
$res=mysqli_query($con,"SELECT * FROM simple_tb WHERE id=$id");
while($row=mysqli_fetch_array($res))
{
?>
<link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
</head>
<h1 align="center"> ABC IDEAL SCHOOL AND COLLEGE</h1>
<h3 align="center">Baraiyahat, Chittagong, 01772969874 </h3>
<p align="center">Students Tuetion Fee Payment Sheet<br></p>
<table class="table" align="center"width="800" bgcolor="skyblue">
<tr><td width="25%">ID No:</td><td width="25%"><?php echo $row['id'];?>
</td></tr>
<tr><td>Name:</td> <td><?php echo $row['n'];?></td></tr>
<tr><td>Class:</td><td><?php echo $row['c'];?></td></tr>
<tr><td>Roll:</td> <td><?php echo $row['r'];?></td></td></tr>
</table>
<br>
<h4 ALIGN="CENTER">PAYMENT STATUS</H4>
<table align="center"width="800" BORDER="1" bgcolor="red">
<tr>
<td align="center"><B>DATES</B></td>
<td align="center"><B>DESCRIPTION</B></td>
<td align="center"><B>MEMO NO</B></td>
<td align="center"><B>BDT</B></td>
<td align="center"><B>Con.Total</B></td>
</tr>
<?php
$res2=mysqli_query($con,"SELECT * FROM ac WHERE sid=".$row['id']);
while($row2=mysqli_fetch_array($res2))
{ $sum+= $row2['t'];
?>
<tr bgcolor="cream">
<td bgcolor="white"align="center"><?php echo $row2['d'];?></td>
<td bgcolor="white"align="center"><?php echo $row2['des'];?>
</td>
<td bgcolor="white"align="center"><?php echo $row2['m'];?></td>
<td bgcolor="white"align="center"><?php echo $row2['t'];?></td>
<td bgcolor="white"align="center"><?php echo $sum."<br>";?></td>
<td bgcolor="white"align="center"></td>
</tr>
<?php
}
?></table><?php
``}
不幸的是,我认为TeamFoundationServerExt tfExt = DTE.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt;
return tfExt.ActiveProjectContext.DomainUri;
并不打算在Visual Studio 2015中使用。有人确认这一点并告诉我应该如何完成
答案 0 :(得分:0)
根据你的描述,我创建了一个演示并使用visual studio 2015测试代码,名为tfExt的变量返回null,如果在VS IDE中打开解决方案,团队资源管理器将自动连接到绑定的TFS服务器解决方案。因此,我们可以使用DTE对象获取SourceControlExt对象,然后从其属性中检索TFS服务器信息。
VersionControlExt vce;
VersionControlExplorerExt vcee;
DTE2 dte = this.ServiceProvider.GetService(typeof(SDTE)) as DTE2;
dte.ExecuteCommand("View.TfsSourceControlExplorer");
vce = dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;
vcee = vce.Explorer;
var tfsServerName = vcee.Workspace.VersionControlServer.TeamFoundationServer.Uri;
请添加以下参考。
using Microsoft.VisualStudio.TeamFoundation.VersionControl;