/////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                DTE dte = (DTE)GetService(typeof(DTE));
                var frameworkMultiTargeting = (IVsFrameworkMultiTargeting)GetService(typeof(SVsFrameworkMultiTargeting));

                migrator = new Migrator(dte, frameworkMultiTargeting);
                var serviceProvider = new ServiceProvider((IServiceProvider)dte);
                solutionLoadEvents     = new SolutionLoadEvents(serviceProvider);
                synchronizationContext = SynchronizationContext.Current;

                solutionLoadEvents.BeforeSolutionLoaded += () =>
                {
                    synchronizationContext.Post(_ => migrator.OnBeforeSolutionLoaded(), null);
                };

                solutionLoadEvents.AfterSolutionLoaded += () =>
                {
                    synchronizationContext.Post(_ => migrator.OnAfterSolutionLoaded(), null);
                };


                // Create the command for the menu item.
                CommandID   menuCommandID = new CommandID(GuidList.guidTargetFrameworkMigratorCmdSet, (int)PkgCmdIDList.cmdidTargetFrameworkMigrator);
                MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandID);
                mcs.AddCommand(menuItem);
            }
        }
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            if ( null != mcs )
            {
                DTE dte = (DTE)GetService(typeof(DTE));

                migrator = new Migrator(dte);
                var serviceProvider = new ServiceProvider((IServiceProvider)dte);
                solutionLoadEvents = new SolutionLoadEvents(serviceProvider);
                synchronizationContext = SynchronizationContext.Current;

                solutionLoadEvents.BeforeSolutionLoaded += () =>
                {
                    synchronizationContext.Post(_ => migrator.OnBeforeSolutionLoaded(), null);
                };
                
                solutionLoadEvents.AfterSolutionLoaded += () =>
                {
                    synchronizationContext.Post(_ => migrator.OnAfterSolutionLoaded(), null);
                };


                // Create the command for the menu item.
                CommandID menuCommandID = new CommandID(GuidList.guidTargetFrameworkMigratorCmdSet, (int)PkgCmdIDList.cmdidTargetFrameworkMigrator);
                MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID );
                mcs.AddCommand( menuItem );
            }
        }