Address PR comments

This commit is contained in:
Justin Goshi 2017-01-24 15:02:19 -08:00
parent 55e80fa036
commit 861d1edfd3
3 changed files with 23 additions and 3 deletions

View file

@ -13,10 +13,15 @@ using System.Linq;
namespace Microsoft.DotNet.Tools.Common
{
public static class SlnFileExtensions
internal static class SlnFileExtensions
{
public static void AddProject(this SlnFile slnFile, string fullProjectPath)
{
if (string.IsNullOrEmpty(fullProjectPath))
{
throw new ArgumentException();
}
var relativeProjectPath = PathUtility.GetRelativePath(
PathUtility.EnsureTrailingSlash(slnFile.BaseDirectory),
fullProjectPath);
@ -54,6 +59,11 @@ namespace Microsoft.DotNet.Tools.Common
public static void AddDefaultBuildConfigurations(this SlnFile slnFile, SlnProject slnProject)
{
if (slnProject == null)
{
throw new ArgumentException();
}
var defaultConfigurations = new List<string>()
{
"Debug|Any CPU",
@ -110,6 +120,11 @@ namespace Microsoft.DotNet.Tools.Common
public static void AddSolutionFolders(this SlnFile slnFile, SlnProject slnProject)
{
if (slnProject == null)
{
throw new ArgumentException();
}
var solutionFolders = slnProject.GetSolutionFoldersFromProject();
if (solutionFolders.Any())
@ -179,6 +194,11 @@ namespace Microsoft.DotNet.Tools.Common
public static bool RemoveProject(this SlnFile slnFile, string projectPath)
{
if (string.IsNullOrEmpty(projectPath))
{
throw new ArgumentException();
}
var projectPathNormalized = PathUtility.GetPathWithDirectorySeparator(projectPath);
var projectsToRemove = slnFile.Projects.Where((p) =>

View file

@ -8,7 +8,7 @@ using System.Linq;
namespace Microsoft.DotNet.Tools.Common
{
public static class SlnProjectCollectionExtensions
internal static class SlnProjectCollectionExtensions
{
public static IEnumerable<SlnProject> GetProjectsByType(
this SlnProjectCollection projects,

View file

@ -8,7 +8,7 @@ using System.Linq;
namespace Microsoft.DotNet.Tools.Common
{
public static class SlnProjectExtensions
internal static class SlnProjectExtensions
{
public static IList<string> GetSolutionFoldersFromProject(this SlnProject project)
{