Exemplo n.º 1
0
        private void HandleProjectItemChange(ProjectItem projectItem, ProjectItemAction action, string oldName = null)
        {
            Argument.IsNotNull("projectItem", projectItem);

            if (!_isSolutionLoaded)
            {
                return;
            }

            Log.Debug("Handling action '{0}' for item '{1}'", action, projectItem.Name);

            var configuration = _configurationService.LoadConfigurationForCurrentSolution();
            if (configuration.EnableAutoLink)
            {
                var sourceProject = projectItem.ContainingProject;
                var sourceProjectName = sourceProject.Name;
                var projectsToLink = (from projectMapping in configuration.ProjectMappings
                                      where string.Equals(projectMapping.SourceProject, sourceProjectName, StringComparison.OrdinalIgnoreCase)
                                      select _visualStudioService.GetProjectByName(projectMapping.TargetProject)).ToArray();

                var linker = new Linker(sourceProject, projectsToLink, configuration);
                linker.RemoveMissingFiles = true;
                linker.HandleProjectItemChange(projectItem, action, oldName);
            }
        }