void UnloadProjectSystem()
 {
     if (applicationLifetime != null) {
         applicationLifetime.Stopping ();
         applicationLifetime.Dispose ();
         applicationLifetime = null;
         projectSystem.Dispose ();
         projectSystem = null;
         context = null;
     }
 }
 void UnloadProjectSystem()
 {
     initializeError = String.Empty;
     if (applicationLifetime != null) {
         applicationLifetime.Stopping ();
         applicationLifetime.Dispose ();
         applicationLifetime = null;
         if (projectSystem != null) {
             projectSystem.Dispose ();
             projectSystem = null;
         }
         context = null;
     }
 }
        internal void LoadAspNetProjectSystem(Solution solution)
        {
            UnloadProjectSystem ();

            applicationLifetime = new MonoDevelopApplicationLifetime ();
            context = new DnxContext ();
            var factory = new AspNet5ProjectSystemFactory ();
            projectSystem = factory.CreateProjectSystem (solution, applicationLifetime, context);
            projectSystem.Initalize ();
        }
        void LoadDnxProjectSystem(Solution solution)
        {
            UnloadProjectSystem ();

            applicationLifetime = new MonoDevelopApplicationLifetime ();
            context = new DnxContext ();
            var factory = new DnxProjectSystemFactory ();
            projectSystem = factory.CreateProjectSystem (solution, applicationLifetime, context);
            projectSystem.Initalize ();

            if (context.RuntimePath == null) {
                string error = GetRuntimeError (projectSystem);
                throw new ApplicationException (error);
            }
        }