예제 #1
0
        public override int Run(string fileOrDirectory)
        {
            SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(fileOrDirectory);

            if (RemainingArguments.Count == 0)
            {
                throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToRemove);
            }

            var relativeProjectPaths = RemainingArguments.Select((p) =>
                                                                 PathUtility.GetRelativePath(
                                                                     PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory),
                                                                     Path.GetFullPath(p))).ToList();

            bool slnChanged = false;

            foreach (var path in relativeProjectPaths)
            {
                slnChanged |= RemoveProject(slnFile, path);
            }

            RemoveEmptyConfigurationSections(slnFile);

            RemoveEmptySolutionFolders(slnFile);

            if (slnChanged)
            {
                slnFile.Write();
            }

            return(0);
        }
예제 #2
0
        private void UpdateSolutionFile(MigrationReport migrationReport)
        {
            if (_slnFile == null)
            {
                return;
            }

            if (migrationReport.FailedProjectsCount > 0)
            {
                return;
            }

            foreach (var project in _slnFile.Projects)
            {
                var projectDirectory = Path.Combine(
                    _slnFile.BaseDirectory,
                    Path.GetDirectoryName(project.FilePath));

                var csprojFiles = new DirectoryInfo(projectDirectory)
                                  .EnumerateFiles()
                                  .Where(f => f.Extension == ".csproj");

                if (csprojFiles.Count() == 1)
                {
                    project.FilePath = Path.Combine(Path.GetDirectoryName(project.FilePath), csprojFiles.First().Name);
                    project.TypeGuid = ProjectTypeGuids.CSharpProjectTypeGuid;
                }
            }

            _slnFile.Write();
        }
예제 #3
0
        public override int Execute()
        {
            SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(_fileOrDirectory);

            var baseDirectory        = PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory);
            var relativeProjectPaths = _arguments.Select(p => {
                var fullPath = Path.GetFullPath(p);
                return(Path.GetRelativePath(
                           baseDirectory,
                           Directory.Exists(fullPath) ?
                           MsbuildProject.GetProjectFileFromDirectory(fullPath).FullName :
                           fullPath
                           ));
            });

            bool slnChanged = false;

            foreach (var path in relativeProjectPaths)
            {
                slnChanged |= slnFile.RemoveProject(path);
            }

            slnFile.RemoveEmptyConfigurationSections();

            slnFile.RemoveEmptySolutionFolders();

            if (slnChanged)
            {
                slnFile.Write();
            }

            return(0);
        }
예제 #4
0
파일: Program.cs 프로젝트: vladdou/cli
        public override int Run(string fileOrDirectory)
        {
            SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(fileOrDirectory);

            if (RemainingArguments.Count == 0)
            {
                throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd);
            }

            PathUtility.EnsureAllPathsExist(RemainingArguments, CommonLocalizableStrings.ProjectDoesNotExist);
            var fullProjectPaths = RemainingArguments.Select((p) => Path.GetFullPath(p)).ToList();

            int preAddProjectCount = slnFile.Projects.Count;

            foreach (var fullProjectPath in fullProjectPaths)
            {
                slnFile.AddProject(fullProjectPath);
            }

            if (slnFile.Projects.Count > preAddProjectCount)
            {
                slnFile.Write();
            }

            return(0);
        }
예제 #5
0
        public override int Execute()
        {
            SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(_fileOrDirectory);

            if (_appliedCommand.Arguments.Count == 0)
            {
                throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd);
            }

            PathUtility.EnsureAllPathsExist(_appliedCommand.Arguments, CommonLocalizableStrings.CouldNotFindProjectOrDirectory, true);

            var fullProjectPaths = _appliedCommand.Arguments.Select(p => {
                var fullPath = Path.GetFullPath(p);
                return(Directory.Exists(fullPath) ?
                       MsbuildProject.GetProjectFileFromDirectory(fullPath).FullName :
                       fullPath);
            }).ToList();

            var preAddProjectCount = slnFile.Projects.Count;

            foreach (var fullProjectPath in fullProjectPaths)
            {
                slnFile.AddProject(fullProjectPath);
            }

            if (slnFile.Projects.Count > preAddProjectCount)
            {
                slnFile.Write();
            }

            return(0);
        }
예제 #6
0
파일: Program.cs 프로젝트: zumeymedia/cli
        public override int Execute()
        {
            SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(_fileOrDirectory);

            var relativeProjectPaths = _appliedCommand.Arguments.Select(p =>
                                                                        PathUtility.GetRelativePath(
                                                                            PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory),
                                                                            Path.GetFullPath(p)))
                                       .ToList();

            bool slnChanged = false;

            foreach (var path in relativeProjectPaths)
            {
                slnChanged |= slnFile.RemoveProject(path);
            }

            slnFile.RemoveEmptyConfigurationSections();

            slnFile.RemoveEmptySolutionFolders();

            if (slnChanged)
            {
                slnFile.Write();
            }

            return(0);
        }
예제 #7
0
        public void Save()
        {
            SlnFile.Write();

            foreach (var project in BuildableProjects)
            {
                project.Save();
            }
        }
예제 #8
0
        private void UpdateSolutionFile(MigrationReport migrationReport)
        {
            if (_slnFile == null)
            {
                return;
            }

            if (migrationReport.FailedProjectsCount > 0)
            {
                return;
            }

            List <string> csprojFilesToAdd = new List <string>();

            var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(_slnFile.BaseDirectory);

            foreach (var report in migrationReport.ProjectMigrationReports)
            {
                var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory);
                var reportRelPath = Path.Combine(
                    PathUtility.GetRelativePath(slnPathWithTrailingSlash, reportPathWithTrailingSlash),
                    report.ProjectName + ".xproj");

                var projects = _slnFile.Projects.Where(p => p.FilePath == reportRelPath);

                var migratedProjectName = report.ProjectName + ".csproj";
                if (projects.Count() == 1)
                {
                    var slnProject = projects.Single();
                    slnProject.FilePath = Path.Combine(
                        Path.GetDirectoryName(slnProject.FilePath),
                        migratedProjectName);
                    slnProject.TypeGuid = ProjectTypeGuids.CSharpProjectTypeGuid;
                }
                else
                {
                    csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, migratedProjectName));
                }

                foreach (var preExisting in report.PreExistingCsprojDependencies)
                {
                    csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, preExisting));
                }
            }

            _slnFile.Write();

            foreach (var csprojFile in csprojFilesToAdd)
            {
                AddProject(_slnFile.FullPath, csprojFile);
            }
        }
        public void WhenGivenAValidSlnFileItModifiesSavesAndVerifiesContents()
        {
            var tmpFile = Temp.CreateFile();

            tmpFile.WriteAllText(SolutionWithAppAndLibProjects);

            SlnFile slnFile = SlnFile.Read(tmpFile.Path);

            slnFile.FormatVersion              = "14.00";
            slnFile.ProductDescription         = "Visual Studio 16";
            slnFile.VisualStudioVersion        = "16.0.26006.2";
            slnFile.MinimumVisualStudioVersion = "11.0.40219.1";

            slnFile.Projects.Count.Should().Be(2);
            var project = slnFile.Projects[0];

            project.Id       = "{9A19103F-16F7-4668-BE54-9A1E7A4F7556}";
            project.TypeGuid = "{7072A694-548F-4CAE-A58F-12D257D5F486}";
            project.Name     = "AppModified";
            project.FilePath = Path.Combine("AppModified", "AppModified.csproj");
            slnFile.Projects.Remove(slnFile.Projects[1]);

            slnFile.SolutionConfigurationsSection.Count.Should().Be(6);
            slnFile.SolutionConfigurationsSection.Remove("Release|Any CPU");
            slnFile.SolutionConfigurationsSection.Remove("Release|x64");
            slnFile.SolutionConfigurationsSection.Remove("Release|x86");

            slnFile.ProjectConfigurationsSection.Count.Should().Be(2);
            var projectConfigSection = slnFile
                                       .ProjectConfigurationsSection
                                       .GetPropertySet("{21D9159F-60E6-4F65-BC6B-D01B71B15FFC}");

            slnFile.ProjectConfigurationsSection.Remove(projectConfigSection);

            slnFile.Sections.Count.Should().Be(3);
            var solutionPropertiesSection = slnFile.Sections.GetSection("SolutionProperties");

            solutionPropertiesSection.Properties.Count.Should().Be(1);
            solutionPropertiesSection.Properties.SetValue("HideSolutionNode", "TRUE");

            slnFile.Write();

            File.ReadAllText(tmpFile.Path)
            .Should().Be(SolutionModified);
        }
        public void It_writes_an_sln_file()
        {
            var solutionDirectory =
                TestAssetsManager.CreateTestInstance("TestAppWithSln", callingMethod: "p").Path;

            var solutionFullPath = Path.Combine(solutionDirectory, "TestAppWithSln.sln");

            var slnFile = new SlnFile();

            slnFile.Read(solutionFullPath);

            slnFile.Projects.Count.Should().Be(1);
            var project = slnFile.Projects[0];

            project.Name.Should().Be("TestAppWithSln");
            project.Name = "New Project Name";
            project.FilePath.Should().Be("TestAppWithSln.xproj");
            project.FilePath = "New File Path";

            var newSolutionFullPath = Path.Combine(solutionDirectory, "TestAppWithSln_modified.sln");

            slnFile.Write(newSolutionFullPath);

            slnFile = new SlnFile();
            slnFile.Read(newSolutionFullPath);
            slnFile.FormatVersion.Should().Be("12.00");
            slnFile.ProductDescription.Should().Be("Visual Studio 14");
            slnFile.VisualStudioVersion.Should().Be("14.0.25420.1");
            slnFile.MinimumVisualStudioVersion.Should().Be("10.0.40219.1");
            slnFile.BaseDirectory.Should().Be(solutionDirectory);
            slnFile.FileName.FileName.Should().Be("TestAppWithSln_modified.sln");
            SlnFile.GetFileVersion(solutionFullPath).Should().Be("12.00");
            slnFile.Projects.Count.Should().Be(1);
            project = slnFile.Projects[0];
            project.Id.Should().Be("{0138CB8F-4AA9-4029-A21E-C07C30F425BA}");
            project.TypeGuid.Should().Be("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}");
            project.Name.Should().Be("New Project Name");
            project.FilePath.Should().Be("New File Path");
            slnFile.Projects.Count.Should().Be(1);
            project = slnFile.Projects[0];
        }
예제 #11
0
파일: Program.cs 프로젝트: agocke/sdk
        public override int Execute()
        {
            SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(_fileOrDirectory);

            var arguments = (_parseResult.ValueForArgument <IEnumerable <string> >(SlnAddParser.ProjectPathArgument) ?? Array.Empty <string>()).ToList().AsReadOnly();

            if (arguments.Count == 0)
            {
                throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd);
            }

            PathUtility.EnsureAllPathsExist(arguments, CommonLocalizableStrings.CouldNotFindProjectOrDirectory, true);

            var fullProjectPaths = arguments.Select(p =>
            {
                var fullPath = Path.GetFullPath(p);
                return(Directory.Exists(fullPath) ?
                       MsbuildProject.GetProjectFileFromDirectory(fullPath).FullName :
                       fullPath);
            }).ToList();

            var preAddProjectCount = slnFile.Projects.Count;

            foreach (var fullProjectPath in fullProjectPaths)
            {
                // Identify the intended solution folders
                var solutionFolders = DetermineSolutionFolder(slnFile, fullProjectPath);

                slnFile.AddProject(fullProjectPath, solutionFolders);
            }

            if (slnFile.Projects.Count > preAddProjectCount)
            {
                slnFile.Write();
            }

            return(0);
        }
		void WriteFileInternal (string file, string sourceFile, Solution solution, bool saveProjects, ProgressMonitor monitor)
		{
			if (saveProjects) {
				var items = solution.GetAllSolutionItems ().ToArray ();
				monitor.BeginTask (items.Length + 1);
				foreach (var item in items) {
					try {
						monitor.BeginStep ();
						item.SavingSolution = true;
						item.SaveAsync (monitor).Wait ();
					} finally {
						item.SavingSolution = false;
					}
				}
			} else {
				monitor.BeginTask (1);
				monitor.BeginStep ();
			}

			SlnFile sln = new SlnFile ();
			sln.FileName = file;
			if (File.Exists (sourceFile)) {
				try {
					sln.Read (sourceFile);
				} catch (Exception ex) {
					LoggingService.LogError ("Existing solution can't be updated since it can't be read", ex);
				}
			}

			sln.FormatVersion = format.SlnVersion;

			// Don't modify the product description if it already has a value
			if (string.IsNullOrEmpty (sln.ProductDescription))
				sln.ProductDescription = format.ProductDescription;

			solution.WriteSolution (monitor, sln);

			sln.Write (file);
			monitor.EndTask ();
		}
예제 #13
0
        public void Generate(bool ForceRegenerate)
        {
            var s = new SlnFile();

            s.FullPath = OutputDirectory / (SolutionName + ".sln");
            using (var sr = new StringReader(SlnTemplateText))
            {
                s.Read(sr);
            }

            s.Projects.Clear();
            s.SolutionConfigurationsSection.Clear();
            s.ProjectConfigurationsSection.Clear();

            foreach (var ConfigurationType in Enum.GetValues(typeof(ConfigurationType)).Cast <ConfigurationType>())
            {
                var ConfigurationTypeAndArchitecture = $"{ConfigurationType}|{GetArchitectureString(TargetOperatingSystem, TargetArchitecture)}";
                s.SolutionConfigurationsSection.SetValue(ConfigurationTypeAndArchitecture, ConfigurationTypeAndArchitecture);
            }

            SlnSection NestedProjects = null;

            foreach (var Section in s.Sections.Where(Section => Section.Id == "NestedProjects"))
            {
                Section.Clear();
                NestedProjects = Section;
            }

            if (NestedProjects == null)
            {
                NestedProjects = new SlnSection
                {
                    Id = "NestedProjects"
                };
                s.Sections.Add(NestedProjects);
            }

            var Filters = new Dictionary <String, String>(StringComparer.OrdinalIgnoreCase);

            foreach (var Project in ProjectReferences)
            {
                var Dir = Project.VirtualDir.ToString(PathStringStyle.Windows);
                if (!Filters.ContainsKey(Dir))
                {
                    var CurrentDir       = Dir.AsPath();
                    var CurrentDirFilter = CurrentDir.ToString(PathStringStyle.Windows);
                    while ((CurrentDirFilter != ".") && !Filters.ContainsKey(CurrentDirFilter))
                    {
                        var g = Guid.ParseExact(Hash.GetHashForPath(CurrentDirFilter, 32), "N").ToString().ToUpper();
                        Filters.Add(CurrentDirFilter, g);
                        CurrentDir       = CurrentDir.Parent;
                        CurrentDirFilter = CurrentDir.ToString(PathStringStyle.Windows);
                        if (CurrentDirFilter != ".")
                        {
                            var gUpper = Guid.ParseExact(Hash.GetHashForPath(CurrentDirFilter, 32), "N").ToString().ToUpper();
                            NestedProjects.Properties.SetValue("{" + g + "}", "{" + gUpper + "}");
                        }
                    }
                }

                s.Projects.Add(new SlnProject
                {
                    TypeGuid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}",
                    Name     = Project.Name,
                    FilePath = Project.FilePath.FullPath.RelativeTo(OutputDirectory).ToString(PathStringStyle.Windows),
                    Id       = "{" + Project.Id + "}"
                });

                var conf = new SlnPropertySet("{" + Project.Id + "}");
                foreach (var c in s.SolutionConfigurationsSection)
                {
                    var Value = TargetOperatingSystem == OperatingSystemType.Windows ? c.Value.Replace("|x86", "|Win32") : c.Value;
                    conf.SetValue(c.Key + ".ActiveCfg", Value);
                    conf.SetValue(c.Key + ".Build.0", Value);
                }
                s.ProjectConfigurationsSection.Add(conf);

                if (Dir != ".")
                {
                    NestedProjects.Properties.SetValue("{" + Project.Id + "}", "{" + Filters[Dir] + "}");
                }
            }

            foreach (var f in Filters)
            {
                s.Projects.Add(new SlnProject
                {
                    TypeGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}",
                    Name     = f.Key.AsPath().FileName,
                    FilePath = f.Key.AsPath().FileName,
                    Id       = "{" + f.Value + "}"
                });
            }

            foreach (var Section in s.Sections.Where(Section => Section.Id == "ExtensibilityGlobals"))
            {
                Section.Properties.SetValue("SolutionGuid", "{" + SolutionId.ToUpper() + "}");
            }

            String Text;

            using (var sw = new StringWriter())
            {
                s.Write(sw);
                Text = sw.ToString();
            }
            TextFile.WriteToFile(s.FullPath, Text, Encoding.UTF8, !ForceRegenerate);
        }
예제 #14
0
        private void UpdateSolutionFile(MigrationReport migrationReport)
        {
            if (_slnFile == null)
            {
                return;
            }

            if (migrationReport.FailedProjectsCount > 0)
            {
                return;
            }

            var csprojFilesToAdd = new HashSet<string>();

            var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(_slnFile.BaseDirectory);
            foreach (var report in migrationReport.ProjectMigrationReports)
            {
                var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory);
                var relativeReportPath = PathUtility.GetRelativePath(
                    slnPathWithTrailingSlash,
                    reportPathWithTrailingSlash);

                var xprojPath = Path.Combine(relativeReportPath, report.ProjectName + ".xproj");
                var xprojProjectsReferencedBySolution = _slnFile.Projects.Where(p => p.FilePath == xprojPath);

                var migratedProjectName = report.ProjectName + ".csproj";
                if (xprojProjectsReferencedBySolution.Count() == 1)
                {
                    var slnProject = xprojProjectsReferencedBySolution.Single();
                    slnProject.FilePath = Path.Combine(
                        Path.GetDirectoryName(slnProject.FilePath),
                        migratedProjectName);
                    slnProject.TypeGuid = ProjectTypeGuids.CSharpProjectTypeGuid;
                }
                else
                {
                    var csprojPath = Path.Combine(relativeReportPath, migratedProjectName);
                    var solutionContainsCsprojPriorToMigration = _slnFile.Projects
                        .Where(p => p.FilePath == csprojPath)
                        .Any();

                    if (!solutionContainsCsprojPriorToMigration)
                    {
                        csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, migratedProjectName));
                    }
                }

                foreach (var preExisting in report.PreExistingCsprojDependencies)
                {
                    csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, preExisting));
                }
            }

            Version version;
            if (!Version.TryParse(_slnFile.VisualStudioVersion, out version) || version.Major < 15)
            {
                _slnFile.ProductDescription = ProductDescription;
                _slnFile.VisualStudioVersion = VisualStudioVersion;
                _slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion;
            }

            _slnFile.Write();

            foreach (var csprojFile in csprojFilesToAdd)
            {
                AddProject(_slnFile.FullPath, csprojFile);
            }
        }
예제 #15
0
        internal static CommandLineApplication CreateApplication(CommandLineApplication parentApp)
        {
            CommandLineApplication app = parentApp.Command("project", throwOnUnexpectedArg: false);

            app.FullName    = LocalizableStrings.AppFullName;
            app.Description = LocalizableStrings.AppDescription;
            app.HandleRemainingArguments  = true;
            app.ArgumentSeparatorHelpText = LocalizableStrings.AppHelpText;

            app.HelpOption("-h|--help");

            app.OnExecute(() =>
            {
                try
                {
                    if (!parentApp.Arguments.Any())
                    {
                        throw new GracefulException(CommonLocalizableStrings.RequiredArgumentNotPassed, Constants.ProjectOrSolutionArgumentName);
                    }

                    var projectOrDirectory = parentApp.Arguments.First().Value;
                    if (string.IsNullOrEmpty(projectOrDirectory))
                    {
                        projectOrDirectory = PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory());
                    }

                    SlnFile slnFile = SlnFileFactory.CreateFromFileOrDirectory(projectOrDirectory);

                    if (app.RemainingArguments.Count == 0)
                    {
                        throw new GracefulException(CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd);
                    }

                    List <string> projectPaths = app.RemainingArguments;
                    PathUtility.EnsureAllPathsExist(projectPaths, CommonLocalizableStrings.ProjectDoesNotExist);
                    var relativeProjectPaths = projectPaths.Select((p) =>
                                                                   PathUtility.GetRelativePath(
                                                                       PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory),
                                                                       Path.GetFullPath(p))).ToList();

                    int preAddProjectCount = slnFile.Projects.Count;
                    foreach (var project in relativeProjectPaths)
                    {
                        AddProject(slnFile, project);
                    }

                    if (slnFile.Projects.Count > preAddProjectCount)
                    {
                        slnFile.Write();
                    }

                    return(0);
                }
                catch (GracefulException e)
                {
                    Reporter.Error.WriteLine(e.Message.Red());
                    app.ShowHelp();
                    return(1);
                }
            });

            return(app);
        }
예제 #16
0
        private void UpdateSolutionFile(MigrationReport migrationReport, SlnFile slnFile)
        {
            if (slnFile == null)
            {
                return;
            }

            if (migrationReport.FailedProjectsCount > 0)
            {
                return;
            }

            var csprojFilesToAdd   = new HashSet <string>();
            var xprojFilesToRemove = new HashSet <string>();

            var slnPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory);

            foreach (var report in migrationReport.ProjectMigrationReports)
            {
                var reportPathWithTrailingSlash = PathUtility.EnsureTrailingSlash(report.ProjectDirectory);
                var relativeReportPath          = PathUtility.GetRelativePath(
                    slnPathWithTrailingSlash,
                    reportPathWithTrailingSlash);

                var migratedProjectName = report.ProjectName + ".csproj";
                var csprojPath          = Path.Combine(relativeReportPath, migratedProjectName);
                var solutionContainsCsprojPriorToMigration = slnFile
                                                             .Projects
                                                             .Any(p => p.FilePath == csprojPath);

                if (!solutionContainsCsprojPriorToMigration)
                {
                    csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, migratedProjectName));
                }

                foreach (var preExisting in report.PreExistingCsprojDependencies)
                {
                    csprojFilesToAdd.Add(Path.Combine(report.ProjectDirectory, preExisting));
                }

                var projectDirectory = new DirectoryInfo(report.ProjectDirectory);
                foreach (var xprojFileName in projectDirectory.EnumerateFiles("*.xproj"))
                {
                    var xprojPath = Path.Combine(relativeReportPath, xprojFileName.Name);
                    var solutionContainsXprojFileToRemove = slnFile
                                                            .Projects
                                                            .Any(p => p.FilePath == xprojPath);

                    if (solutionContainsXprojFileToRemove)
                    {
                        xprojFilesToRemove.Add(Path.Combine(report.ProjectDirectory, xprojFileName.Name));
                    }
                }
            }

            Version version;

            if (!Version.TryParse(slnFile.VisualStudioVersion, out version) || version.Major < 15)
            {
                slnFile.ProductDescription         = ProductDescription;
                slnFile.VisualStudioVersion        = VisualStudioVersion;
                slnFile.MinimumVisualStudioVersion = MinimumVisualStudioVersion;
            }

            RemoveReferencesToMigratedFiles(slnFile);

            slnFile.Write();

            foreach (var csprojFile in csprojFilesToAdd)
            {
                _solutionFileManipulator.AddProjectToSolution(slnFile.FullPath, csprojFile);
            }

            foreach (var xprojFile in xprojFilesToRemove)
            {
                _solutionFileManipulator.RemoveProjectFromSolution(slnFile.FullPath, xprojFile);
            }
        }