/// <summary> /// Creates a deep copy of this object with the new project instead of the cloned project. /// </summary> /// <returns>A deep copy of this object.</returns> public ConfigurationProvider Clone(Project newProject) { ConfigurationProvider clone = new ConfigurationProvider(newProject); // Clone the configurations collection. clone.projectConfigurations = (ProjectConfigurationCollection)this.ProjectConfigurations.Clone(); clone.projectConfigurations.CollectionChanged += new CollectionChangeEventHandler(clone.ConfigCollectionChanged); foreach (ProjectConfiguration config in clone.projectConfigurations) { config.Project = newProject; } // Clone the listeners collection. clone.eventListeners = (VsCfgProviderEventListenerCollection)this.eventListeners.Clone(); return clone; }