Пример #1
0
        public IProject AddExistingProject(FileName fileName)
        {
            if (parentSolution.Projects.Any(p => p.FileName == fileName))
            {
                throw new ProjectLoadException("Project " + fileName + " is already part of this solution.");
            }
            ProjectLoadInformation loadInfo = new ProjectLoadInformation(parentSolution, fileName, fileName.GetFileNameWithoutExtension());
            IProject project = SD.ProjectService.LoadProject(loadInfo);

            if (parentSolution.GetItemByGuid(project.IdGuid) != null)
            {
                SD.Log.Warn("Added project has duplicate GUID; a new GUID will be generated.");
                project.IdGuid = Guid.NewGuid();
            }
            this.Items.Add(project);
            project.ProjectLoaded();
            ProjectBrowserPad.RefreshViewAsync();
            return(project);
        }