Implement dotnet add project (#5022)

* Implement dotnet add project

* Addressed PR comments
This commit is contained in:
Justin Goshi 2016-12-14 13:53:11 -10:00 committed by GitHub
parent 88ac88802b
commit 441277ccfa
38 changed files with 932 additions and 55 deletions

View file

@ -55,7 +55,7 @@ namespace Microsoft.DotNet.Tools.Add.ProjectToProjectReference
string frameworkString = frameworkOption.Value();
List<string> references = app.RemainingArguments;
MsbuildProject.EnsureAllReferencesExist(references);
PathUtility.EnsureAllPathsExist(references, CommonLocalizableStrings.ReferenceDoesNotExist);
IEnumerable<MsbuildProject> refs = references.Select((r) => MsbuildProject.FromFile(projects, r));
if (frameworkString == null)
@ -95,11 +95,12 @@ namespace Microsoft.DotNet.Tools.Add.ProjectToProjectReference
}
}
msbuildProj.ConvertPathsToRelative(ref references);
var relativePathReferences = references.Select((r) =>
PathUtility.GetRelativePath(msbuildProj.ProjectDirectory, Path.GetFullPath(r))).ToList();
int numberOfAddedReferences = msbuildProj.AddProjectToProjectReferences(
frameworkOption.Value(),
references);
relativePathReferences);
if (numberOfAddedReferences != 0)
{