public void AddImport(string targetPath, ProjectImportLocation location)
        {
            string relativeTargetPath = GetRelativePath(targetPath);

            project.AddImportIfMissing(relativeTargetPath, location);
            ReevaluateProjectIfNecessary();
            projectService.Save(project);
        }
예제 #2
0
        void AddNewImports()
        {
            var importsToAdd = new List <ProjectImportElement>();

            foreach (ProjectImportElement import in msbuildProject.Xml.Imports)
            {
                if (!sharpDevelopProject.ImportExists(import.Project))
                {
                    importsToAdd.Add(import);
                }
            }

            foreach (ProjectImportElement importToAdd in importsToAdd)
            {
                sharpDevelopProject.AddImportIfMissing(importToAdd.Project, ProjectImportLocation.Bottom);
            }

            result.AddProjectImportsAdded(importsToAdd);

            projectService.Save(sharpDevelopProject);
        }