Exemplo n.º 1
0
        private void TesthostComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SetupInstance instance = this.testhostComboBox.SelectedItem as SetupInstance;

            this.txtTesthostPath.Text    = instance.InstallationPath;
            this.txtTestAdapterPath.Text = instance.TestAdapterPath;
        }
Exemplo n.º 2
0
        internal void GetVisualStudio()
        {
            SetupInstance tmp = new SetupInstance();

            tmp.DisplayName      = "系统默认";
            tmp.InstallationPath = this.configurationViewMode.DefaultTesthostPath;
            tmp.TestAdapterPath  = this.configurationViewMode.DefaultTestAdaptersPath;
            vs.Add(tmp);
            try
            {
                var query  = new SetupConfiguration();
                var query2 = (ISetupConfiguration2)query;
                var e      = query2.EnumAllInstances();

                var helper = (ISetupHelper)query;

                int fetched;
                var instances = new ISetupInstance[1];
                do
                {
                    e.Next(1, instances, out fetched);
                    if (fetched > 0)
                    {
                        tmp                  = new SetupInstance();
                        tmp.DisplayName      = instances[0].GetDisplayName();
                        tmp.InstallationPath = instances[0].GetInstallationPath() + "\\Common7\\IDE\\Extensions\\TestPlatform\\";
                        tmp.TestAdapterPath  = tmp.InstallationPath + "Extensions\\";
                        vs.Add(tmp);
                    }
                }while (fetched > 0);
            }
            catch (COMException ex) when(ex.HResult == REGDB_E_CLASSNOTREG)
            {
            }
            catch (Exception)
            {
            }
        }