protected override void Initialize()
        {
            base.Initialize();
            _updateLock = new object();
            IVsExtensibility extensibility = GetService <IVsExtensibility>();

            _DTE2    = (DTE2)extensibility.GetGlobalsObject(null).DTE;
            _Version = GetVersion(_DTE2.Version);

            _Solution = GetService <SVsSolution>() as IVsSolution;
            IVsCfgProvider2 test = _Solution as IVsCfgProvider2;

            _SolutionEvents = new SolutionEvents();
            int  hr;
            uint pdwCookie;

            hr = _Solution.AdviseSolutionEvents(_SolutionEvents, out pdwCookie);
            Marshal.ThrowExceptionForHR(hr);

            _UpdateSolutionEvents = new UpdateSolutionEvents();
            var vsSolutionBuildManager = GetService <SVsSolutionBuildManager>();

            hr = (vsSolutionBuildManager as IVsSolutionBuildManager3).AdviseUpdateSolutionEvents3(_UpdateSolutionEvents, out pdwCookie);
            Marshal.ThrowExceptionForHR(hr);
            hr = (vsSolutionBuildManager as IVsSolutionBuildManager2).AdviseUpdateSolutionEvents(_UpdateSolutionEvents, out pdwCookie);
            Marshal.ThrowExceptionForHR(hr);

            if (VersionGreaterEqualTo(DTEVersion.VS15))
            {
                LoadMef();
            }
        }
 private static bool VersionGreaterEqualTo(DTEVersion version)
 {
     return((int)_Version >= (int)version);
 }
 private static bool VersionLessThan(DTEVersion version)
 {
     return((int)_Version < (int)version);
 }