Exemplo n.º 1
0
        public bool Execute(string source, string target, bool overwrite, bool addFolder, bool addSameGuid)
        {
            var isDirty        = false;
            var sourceSolution = EditableSolutionFile.FromFile(Path.GetFullPath(source));
            var targetSolution = EditableSolutionFile.FromFile(Path.GetFullPath(target));
            var mergedResult   = Merge(sourceSolution, targetSolution, addFolder, addSameGuid);

            if (overwrite)
            {
                mergedResult.MergedSolution.Save();
                mergedResult.ConflictingSolutions.ForEach(item =>
                {
                    Logger.Warn($"Updating solutions with project guids conflicts: {item.SolutionFullPath}");
                    item.Save();
                });

                mergedResult.ConflictingProjects.ForEach(item =>
                {
                    Logger.Warn($"Updating project guids/reference conflicts: {item.FullPath}");
                    item.Save();
                });
                isDirty = true;
            }

            return(isDirty);
        }
        public UnityProjectConfigurator(string directory)
        {
            ProjectDirectory = new DirectoryInfo(directory);
            ProjectName      = ProjectDirectory.Name;
            ProjectVersion   = FindProjectVersion(ProjectDirectory);

            var slnPath = Path.Combine(ProjectDirectory.FullName, ProjectName + ".sln");

            if (File.Exists(slnPath))
            {
                SolutionFile = SolutionFile.FromFile(slnPath);
            }
        }