Visual studio 2013 Visual Studio 2013团队资源管理器扩展未显示

Visual studio 2013 Visual Studio 2013团队资源管理器扩展未显示,visual-studio-2013,visual-studio-extensions,team-explorer,Visual Studio 2013,Visual Studio Extensions,Team Explorer,我正试图在Visual Studio 2013中构建团队资源管理器的扩展。我在博客中找到了添加导航项和页面的步骤,但是当我运行项目时,我没有看到扩展 输出中没有错误。我可以看到正在调用构造函数,但没有向团队资源管理器添加任何内容 以下是我们当前的代码: namespace UoA.Cecil.VsTools.WindowPanes { using System; using System.ComponentModel; using System.ComponentMode

我正试图在Visual Studio 2013中构建团队资源管理器的扩展。我在博客中找到了添加导航项和页面的步骤,但是当我运行项目时,我没有看到扩展

输出中没有错误。我可以看到正在调用构造函数,但没有向团队资源管理器添加任何内容

以下是我们当前的代码:

namespace UoA.Cecil.VsTools.WindowPanes
{
    using System;
    using System.ComponentModel;
    using System.ComponentModel.Composition;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using Microsoft.TeamFoundation.Controls;
    using Microsoft.VisualStudio.Shell;

    [TeamExplorerNavigationItem(TeamExplorerGuids.TimesheetNavigationItem, 100)]
    public class TimesheetTeamExplorerNavigationItem
        : ITeamExplorerNavigationItem
    {
        private readonly IServiceProvider serviceProvider;
        private bool isVisible;

        [ImportingConstructor]
        public TimesheetTeamExplorerNavigationItem([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public Image Image
        {
            get { return Resources.TimesheetImage; }
        }

        public bool IsVisible
        {
            get { return this.isVisible; }
            private set
            {
                this.isVisible = value;
                this.FirePropertyChanged();
            }
        }

        public string Text
        {
            get { return "Timesheet"; }
        }

        public void Dispose()
        {
        }

        public void Execute()
        {
            // Do something here
        }

        public T GetService<T>()
        {
            if (this.serviceProvider != null)
            {
                return (T)this.serviceProvider.GetService(typeof(T));
            }
            return default(T);
        }

        public void Invalidate()
        {
        }

        private void FirePropertyChanged([CallerMemberName] string propertyName = null)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
名称空间UoA.Cecil.VsTools.WindowPanes
{
使用制度;
使用系统组件模型;
使用System.ComponentModel.Composition;
使用系统图;
使用System.Runtime.CompilerServices;
使用Microsoft.TeamFoundation.Controls;
使用Microsoft.VisualStudio.Shell;
[TeamExplorerNavigationItem(TeamExplorerGuids.TimesheetNavigationItem,100)]
公共类时间表ExplorerNavigationItem
:ITeamExplorerNavigationItem
{
私有只读服务器ViceProvider服务提供商;
私有布尔是可见的;
[导入构造函数]
公共时间表amexplorernavigationItem([Import(typeof(SVsServiceProvider))]IServiceProvider服务提供商)
{
this.serviceProvider=serviceProvider;
}
公共事件属性更改事件处理程序属性更改;
公众形象
{
获取{return Resources.TimesheetImage;}
}
公共图书馆是可见的
{
获取{返回this.isVisible;}
专用设备
{
this.isVisible=值;
此.FirePropertyChanged();
}
}
公共字符串文本
{
获取{返回“时间表”;}
}
公共空间处置()
{
}
public void Execute()
{
//在这里做点什么
}
公共服务
{
if(this.serviceProvider!=null)
{
返回(T)this.serviceProvider.GetService(typeof(T));
}
返回默认值(T);
}
公共无效
{
}
私有void FirePropertyChanged([CallerMemberName]字符串propertyName=null)
{
if(this.PropertyChanged!=null)
{
this.PropertyChanged(this,newpropertychangedventargs(propertyName));
}
}
}
}

你知道为什么会发生这种情况吗?

当你连接到团队项目时,你可以经常看到这个按钮。验证CurrentContext属性是否不为null,并且是否携带连接的TFS上下文

或者,您还可以验证构造函数中的
serviceProvider
字段是否不为空

可见性通常在
Invalidate
方法中处理,如下所示。我已经为我的客户实现了以下功能


公共覆盖无效失效()
{
if(CurrentContext!=null&&CurrentContext.HasCollection&&CurrentContext.HasTeamProject)
{
IsVisible=true;
}
其他的
{
IsVisible=false;
}
}

谢谢乌萨什-我没有将IsVisible设置为true。