开发者

Error executing TFS command

I have an exception when calling Workspace.Merge. I am getting access to VersionControlExt from VisualStudio. The code below gets access to Visual Studio TFS explorer window object (that is active in the environment and user is logged in).

VersionControlExt vce;
vce = _applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;

MergeCandidate[] candidates = version.GetMergeCandidates(source, dest, RecursionType.Full);
Workspace ws = vce.Explorer.Workspace;

foreach (Mer开发者_JS百科geCandidate mc in candidates)
{
 string comment = mc.Changeset.Comment;
 ChangesetVersionSpec csvs = new ChangesetVersionSpec(mc.Changeset.ChangesetId);


// HERE NULL REFERENCE EXCEPTION IS THROWN
GetStatus gs = ws.Merge(source, dest, csvs, csvs, LockLevel.None, RecursionType.Full, MergeOptionsEx.None);
}

Exception Details

TargetSite: {System.String get_AuthorizedUser()}

StackTrace

at Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.get_AuthorizedUser()\r\n at Microsoft.TeamFoundation.VersionControl.Client.Workspace.get_DisplayName()\r\n at Microsoft.TeamFoundation.VersionControl.Client.Workspace.RequireLocal()\r\n at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Merge(ItemSpec source, String targetPath, VersionSpec versionFrom, VersionSpec versionTo, LockLevel lockLevel, MergeOptionsEx mergeOptions, String[] propertyNameFilters)\r\n at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Merge(ItemSpec source, String targetPath, VersionSpec versionFrom, VersionSpec versionTo, LockLevel lockLevel, MergeOptionsEx mergeOptions)\r\n at Microsoft.TeamFoundation.VersionControl.Client.Workspace.Merge(String sourcePath, String targetPath, VersionSpec versionFrom, VersionSpec versionTo, LockLevel lockLevel, RecursionType recursion, MergeOptionsEx mergeOptions)\r\n


What is the exception's Type and Message?

What version of Team Explorer locally? What version of TFS server?

Given get_AuthorizedUser at top of stack, I suspect this is the TFS client failing to authenticate—start by checking the current directory is in a mapped workspace and the current user is authorized on TFS.


Found the problem. In order to use TFS functionality one needs to reference Microsoft.TeamFoundation.VersionControl.Client.dll. I have both 9.0 Studio and 10.0 Studio installed. I have referenced dlls from 10.0 while actually using 9.0 studio. Stupid mistake but it has taken hours to debug.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜