- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 TFS 2015 update 2,在一台机器上安装了一个代理,代理创建了它的工作空间:
内部开发的一些自定义 MSBuild 任务已在将在代理上运行的构建定义中实现。这些任务对 TFS 服务器执行一些操作。
当构建定义排队等待新构建时,我得到的是:
在构建机器中,我继续运行以下脚本,以验证工作区是否存在:
# Script to find a Team Foundation workspace
param(
[string] $workspaceHint = $(get-location).Path
)
begin
{
# load the needed client dll's
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.VersionControl.Client")
# fetches a Workspace instance matching the WorkspaceInfo found in the cache file
function getWorkspaceFromWorkspaceInfo($wsInfo)
{
$tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($wsInfo.ServerUri.AbsoluteUri)
$vcs = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
$vcs.GetWorkspace($wsInfo)
# TODO: likely add some convenience properties/methods for easier scripting support
}
}
process
{
# is there only 1 workspace in our cache file? If so, use that one regardless of the hint
$workspaceInfos = [Microsoft.TeamFoundation.VersionControl.Client.Workstation]::Current.GetAllLocalWorkspaceInfo()
if ($workspaceInfos.Length -eq 1)
{
return getWorkspaceFromWorkspaceInfo($workspaceInfos[0])
}
if (test-path $workspaceHint)
{
# workspace hint is a local path, get potential matches based on path
$workspaceInfos = [Microsoft.TeamFoundation.VersionControl.Client.Workstation]::Current.GetLocalWorkspaceInfoRecursively($workspaceHint)
}
else
{
# workspace hint is NOT a local path, get potential matches based on name
$workspaceInfos = @($workspaceInfos | ?{ $_.name -match $workspaceHint })
}
if ($workspaceInfos.Length -gt 1)
{
throw 'More than one workspace matches the workspace hint "{0}": {1}' -f
$workspaceHint, [string]::join(', ', @($workspaceInfos | %{ $_.Name}))
}
elseif ($workspaceInfos.Length -eq 1)
{
return getWorkspaceFromWorkspaceInfo($workspaceInfos[0])
}
else
{
throw "Could not figure out a workspace based on hint $workspaceHint"
}
}
脚本无法找到任何工作区。
然后,TFS 2015 Power 工具及其 powershell cmdlet 安装在机器中并运行以下脚本:
if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapin -Name Microsoft.TeamFoundation.PowerShell
}
$ws = Get-TfsWorkspace -Path C:\t\1\s
$ws.Folders
显示工作区和映射的项目。
排队新构建,继续显示相同的错误。工作区是一个公共(public)服务器,按照 msdn 论坛中的一些古老帖子,我清理了机器中的 TFS 缓存。
知道如何让 Microsoft.TeamFoundation.VersionControl.Client 能够识别工作区吗?
最佳答案
我通过运行类似于以下 PowerShell 脚本的程序修复了我机器上的 ItemNotMappedException 问题;
$localReference = "C:\Repository\Project\Project.sln"
$teamProjectCollection="http://tfsserver:8080/tfs/projectcollection"
$username = $env:UserName
Add-type -AssemblyName "Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a"
Add-type -AssemblyName "Microsoft.TeamFoundation.Common, Version=12.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a"
Add-type -AssemblyName "Microsoft.TeamFoundation.VersionControl.Client, Version=12.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a"
Add-type -AssemblyName "Microsoft.TeamFoundation.VersionControl.Common, Version=12.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a"
$folder = [System.IO.Path]::GetDirectoryName($localReference);
Push-Location $folder;
$tfsTeamProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($teamProjectCollection)
$versioncontrolServer = $tfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
[Microsoft.TeamFoundation.VersionControl.Client.Workstation]::Current.EnsureUpdateWorkspaceInfoCache($versionControlServer, $username);
$workspace = $versioncontrolServer.GetWorkspace($localReference)
echo $workspace
Pop-Location
您需要更改初始变量以匹配您的环境。
希望对你有帮助
关于tfs - Microsoft.TeamFoundation.VersionControl.Client.ItemNotMappedException 即使工作区存在并且具有映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41902276/
我有这个 nuget 包(和非扩展包):https://www.nuget.org/packages/Microsoft.TeamFoundationServer.ExtendedClient/ 我看
使用 TFS 2015 update 2,在一台机器上安装了一个代理,代理创建了它的工作空间: 内部开发的一些自定义 MSBuild 任务已在将在代理上运行的构建定义中实现。这些任务对 TFS 服务器
在源代码管理下加载项目时,我在 VS2013 中收到此错误: 程序包“Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage、M
最近,我们在TFS 2010中遇到了一个奇怪的问题。我们花了几天的时间才弄清楚。只想分享我对可能会帮助他人的问题的知识。 之前工作大约两年没有问题。但是突然之间,构建因以下错误而开始失败: Build
我正在关注 https://developers.google.com/admob/unity/start .我已经下载了 Google Mobile Ads Unity Plugin v3.18.2
我按照关于 supporting multiple versions of Visual Studio in developing checkin policies 的文章中的说明进行操作.现在,我在
在 TFS 版本控制 SDK (Microsoft.TeamFoundation.VersionControl) 的上下文中,deletionID 到底是什么? 它是 Microsoft.TeamFo
我相信我正在处理一些 DLL hell 。 我在我的应用程序中引用了 Microsoft.TeamFoundations.VersionControl.Client,并且“复制本地”设置为 true。
我是一名优秀的程序员,十分优秀!