Esempio n. 1
0
        public static void ActivateBridgeVsOnSolution(CommandAction action, List <Project> projects, string solutionName, string vsVersion,
                                                      string vsEdition)
        {
            //enable each individual project by mapping the assembly name and location to a registry entry
            foreach (Project project in projects)
            {
                string path              = project.Properties.Item("FullPath").Value.ToString();
                string outputPath        = project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString();
                string fileName          = project.Properties.Item("OutputFileName").Value.ToString();
                string projectOutputPath = Path.Combine(path, outputPath, fileName);

                string        assemblyName  = project.Properties.Item("AssemblyName").Value.ToString();
                ExecuteParams executeParams = new ExecuteParams(action, project.FullName, solutionName, assemblyName,
                                                                projectOutputPath, vsVersion, vsEdition);
                Execute(executeParams);
            }

            //now create a general solution flag to mark the current solution as activated
            string keyPath = string.Format(PackageConfigurator.GetRegistryKey(EnabledProjectsRegistryKey, vsVersion, solutionName));

            using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyPath, true))
            {
                key?.SetValue(SolutionEnabled, action == CommandAction.Enable ? "True" : "False", RegistryValueKind.String);
            }

            string result     = action == CommandAction.Enable ? "Bridged" : "Un-Bridged";
            string userAction = action == CommandAction.Enable ? "Please rebuild your solution." : string.Empty;
            string message    = $@"Solution {solutionName} has been {result}. {userAction}";

            MessageBox.Show(message);
        }
Esempio n. 2
0
        private static void Execute(ExecuteParams executeParams)
        {
            switch (executeParams.Action)
            {
            case CommandAction.Enable:
                EnableProject(executeParams.ProjectOutput, executeParams.AssemblyName, executeParams.SolutionName,
                              executeParams.VsVersion);
                break;

            case CommandAction.Disable:
                DisableProject(executeParams.AssemblyName, executeParams.SolutionName, executeParams.VsVersion);
                break;
            }
        }