首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >系统命名空间中未显示uri类

系统命名空间中未显示uri类
EN

Stack Overflow用户
提问于 2018-08-09 02:49:30
回答 1查看 208关注 0票数 0

我正在尝试使用.NET 4.5框架编译以下代码:

代码语言:javascript
复制
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Discussion.Client;
using Microsoft.TeamFoundation.VersionControl.Client;

class CodeReview
{

    public List<CodeReviewComment> GetCodeReviewComments(int workItemId)
    {
        List<CodeReviewComment> comments = new List<CodeReviewComment>();
        Uri tfsuri = new Uri(MYURL);
        TeamFoundationDiscussionService service = new TeamFoundationDiscussionService();
        service.Initialize(new Microsoft.TeamFoundation.Client.TfsTeamProjectCollection(tfsuri));
        IDiscussionManager discussionManager = service.CreateDiscussionManager();

        IAsyncResult result = discussionManager.BeginQueryByCodeReviewRequest(workItemId, QueryStoreOptions.ServerAndLocal, new AsyncCallback(CallCompletedCallback), null);
        var output = discussionManager.EndQueryByCodeReviewRequest(result);

        foreach (DiscussionThread thread in output)
        {
            if (thread.RootComment != null)
            {
                CodeReviewComment comment = new CodeReviewComment();
                comment.Author = thread.RootComment.Author.DisplayName;
                comment.Comment = thread.RootComment.Content;
                comment.PublishDate = thread.RootComment.PublishedDate.ToShortDateString();
                comment.ItemName = thread.ItemPath;
                comments.Add(comment);
            }
        }

        return comments;
    }

    static void CallCompletedCallback(IAsyncResult result)
    {
        // Handle error conditions here
    }

    public class CodeReviewComment
    {
        public string Author { get; set; }
        public string Comment { get; set; }
        public string PublishDate { get; set; }
        public string ItemName { get; set; }
    }

}

Visual Studio编译器报告“找不到类型或命名空间' Uri‘”,并且当我在对象浏览器中展开系统命名空间时,它没有列出任何Uri类。我已经尝试了其他几个版本的.NET,仍然有同样的问题,尽管如果我选择Microsoft4.0客户端配置文件,但没有任何TeamFoundation类出现在.NET命名空间中,它确实会出现。

EN

回答 1

Stack Overflow用户

发布于 2018-08-09 04:06:31

我解决了我自己的问题,但我不明白为什么它会起作用。无奈之下,我使用.NET 4.5创建了另一个新项目,并复制并粘贴了代码。它进行了编译,Uri在对象浏览器中显示为一个类。我不知道这两个项目有什么不同。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51753737

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档