public int Execute(CreateSln createSln) { var name = "blank.sln"; if (!string.IsNullOrEmpty(createSln.Name)) { name = createSln.Name; } if (!name.ToLower(CultureInfo.InvariantCulture).EndsWith(".sln")) { name += ".sln"; } if (createSln.Fix) { var content = new List <string> { "Microsoft Visual Studio Solution File, Format Version 12.00", "# Visual Studio 14", "VisualStudioVersion = 14.0.24720.0", "MinimumVisualStudioVersion = 10.0.40219.1" }; if (!createSln.Blank) { var items = new SolutionItems(); AddGitIgnore(items); AddGitAttribute(items); AddReadme(items, name); AddRunsettings(items); content.AddRange(items.Content); } File.WriteAllLines(name, content); Console.WriteLine($"{name} file created"); } return(0); }
private void AddGitAttribute(SolutionItems items) { const string gitattributes = ".gitattributes"; if (!File.Exists(gitattributes)) { var gitattr = ResourceReader.Read("gitattributes"); File.WriteAllText(gitattributes, gitattr); } items.Add(gitattributes); }
private void AddRunsettings(SolutionItems items) { const string runsettings = "default.runsettings"; if (!File.Exists(runsettings)) { var rs = new Runsettings(); File.WriteAllLines(runsettings, rs.FileContent); } items.Add(runsettings); }
private void AddReadme(SolutionItems items, string name) { const string readme = "readme.md"; if (!File.Exists(readme)) { var content = $"### Readme file for {name}" + Environment.NewLine + Environment.NewLine; content += "Add information for the developer about things that are helpful to know in order to work with this program"; File.WriteAllText(readme, content); } items.Add(readme); }
private void AddGitIgnore(SolutionItems items) { const string gitignore = ".gitignore"; if (!File.Exists(gitignore)) { var gi = new GitIgnore(new GitIgnoreCommand { Fix = true }); gi.WriteGitIgnore(); } items.Add(gitignore); }