public MultiProjectDropdownEntry(StartupConfiguration configuration) { this.Configuration = configuration; }
public bool IsEqual(StartupConfiguration other) { return(this.Name == other.Name && this.Projects.Zip(other.Projects, Tuple.Create) .All(tuple => tuple.Item1.IsEqual(tuple.Item2))); }
private void _ActivateMultiProjectConfiguration(StartupConfiguration startupConfiguration) { var startupProjects = startupConfiguration.Projects; _SuspendChangedEvent(() => { if (startupProjects.Count == 1) { // If the multi-project startup configuration contains a single project only, handle it as if it was a single-project configuration var project = startupProjects.Single().Project; if (project == null) { MessageBox.Show("The activated configuration refers to an inexistent project.\nPlease check your configuration file!", "SwitchStartupProject", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } dte.Solution.SolutionBuild.StartupProjects = project.Path; } else { // SolutionBuild.StartupProjects expects an array of objects var projectPathArray = (from startupProject in startupProjects let project = startupProject.Project where project != null select(object) project.Path).ToArray(); if (startupProjects.Count != projectPathArray.Length) { MessageBox.Show("The activated configuration refers to inexistent projects.\nPlease check your configuration file!", "SwitchStartupProject", MessageBoxButton.OK, MessageBoxImage.Exclamation); } dte.Solution.SolutionBuild.StartupProjects = projectPathArray; } // Set properties foreach (var startupProject in startupProjects) { if (startupProject.Project == null) { continue; } var solutionProject = startupProject.Project; var project = solutionProject.Project; if (project == null) { continue; } // Handle VC++ projects in a special way if (new Guid(project.Kind) == GuidList.guidCPlusPlus) { var vcProject = (dynamic)project.Object; foreach (var vcConfiguration in vcProject.Configurations) { var vcDebugSettings = vcConfiguration.DebugSettings; _SetPropertyValue(v => vcDebugSettings.CommandArguments = v, startupProject.CommandLineArguments); _SetPropertyValue(v => vcDebugSettings.WorkingDirectory = v, startupProject.WorkingDirectory); _SetPropertyValue(v => { if (startupProject.EnableRemoteDebugging == true) { vcDebugSettings.RemoteCommand = v; } else { vcDebugSettings.Command = v; } }, startupProject.StartExternalProgram); _SetPropertyValue(v => vcDebugSettings.HttpUrl = v, startupProject.StartBrowserWithUrl); _SetPropertyValue(v => vcDebugSettings.RemoteMachine = v, startupProject.RemoteDebuggingMachine); if (startupProject.EnableRemoteDebugging == true) { _SetDynamicDebuggerFlavor(vcDebugSettings, "eRemoteDebugger"); } else if (!string.IsNullOrEmpty(startupProject.StartBrowserWithUrl)) { _SetDynamicDebuggerFlavor(vcDebugSettings, "eWebBrowserDebugger"); } else if (startupProject.EnableRemoteDebugging == false) { _SetDynamicDebuggerFlavor(vcDebugSettings, "eLocalDebugger"); } else if (!string.IsNullOrEmpty(startupProject.StartExternalProgram)) { _SetDynamicDebuggerFlavor(vcDebugSettings, "eLocalDebugger"); } else if (startupProject.StartProject == true) { _SetDynamicDebuggerFlavor(vcDebugSettings, "eLocalDebugger"); } } } else { foreach (EnvDTE.Configuration configuration in project.ConfigurationManager) { if (configuration == null) { continue; } var properties = configuration.Properties; if (properties == null) { continue; } foreach (var property in properties.Cast <Property>()) { if (property == null) { continue; } _SetPropertyValue(property, solutionProject.StartArgumentsPropertyName, startupProject.CommandLineArguments); _SetPropertyValue(property, "StartWorkingDirectory", startupProject.WorkingDirectory); _SetPropertyValue(property, "StartProgram", startupProject.StartExternalProgram); _SetPropertyValue(property, "StartURL", startupProject.StartBrowserWithUrl); _SetPropertyValue(property, "RemoteDebugEnabled", startupProject.EnableRemoteDebugging); _SetPropertyValue(property, "RemoteDebugMachine", startupProject.RemoteDebuggingMachine); if (!string.IsNullOrEmpty(startupProject.StartExternalProgram)) { _SetPropertyValue(property, "StartAction", 1); } if (!string.IsNullOrEmpty(startupProject.StartBrowserWithUrl)) { _SetPropertyValue(property, "StartAction", 2); } if (startupProject.StartProject == true) { _SetPropertyValue(property, "StartAction", 0); } } } } } }); }