diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs b/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs index 911a5f166fedbec3cf9c61d015141e65f17d6f90..1340a0bcc0889af5255d31cc8875887598799579 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs @@ -471,14 +471,6 @@ public static bool IsSameLanguage(ProjectState project1, ProjectState project2) return project1.LanguageServices == project2.LanguageServices; } - public ProjectState AddProjectReference(ProjectReference projectReference) - { - Contract.Requires(!this.ProjectReferences.Contains(projectReference)); - - return this.With( - projectInfo: this.ProjectInfo.WithProjectReferences(this.ProjectReferences.ToImmutableArray().Add(projectReference)).WithVersion(this.Version.GetNewerVersion())); - } - public ProjectState RemoveProjectReference(ProjectReference projectReference) { Contract.Requires(this.ProjectReferences.Contains(projectReference)); diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs b/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs index a7cdc3588fc427216a6c7b60a6afde3807b7e006..fa949da2cc7338264240bcc5372a5ac1246cbfce 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs @@ -401,7 +401,7 @@ internal Solution WithHasAllInformation(ProjectId projectId, bool hasAllInformat /// public Solution AddProjectReference(ProjectId projectId, ProjectReference projectReference) { - var newState = _state.AddProjectReference(projectId, projectReference); + var newState = _state.AddProjectReferences(projectId, SpecializedCollections.SingletonEnumerable(projectReference)); if (newState == _state) { return this; diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs index 84bee4688e77dd854fdffd9b0909c37f1519a3cf..3262ddb54635d0462fe5da6a1f9b5fcb791015db 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs @@ -769,35 +769,6 @@ private static async Task ReplaceSyntaxTreesWithTreesFromNewProject return compilation.RemoveAllSyntaxTrees().AddSyntaxTrees(syntaxTrees); } - /// - /// Create a new solution instance with the project specified updated to include - /// the specified project reference. - /// - public SolutionState AddProjectReference(ProjectId projectId, ProjectReference projectReference) - { - if (projectId == null) - { - throw new ArgumentNullException(nameof(projectId)); - } - - if (projectReference == null) - { - throw new ArgumentNullException(nameof(projectReference)); - } - - CheckContainsProject(projectId); - CheckContainsProject(projectReference.ProjectId); - CheckNotContainsProjectReference(projectId, projectReference); - CheckNotContainsTransitiveReference(projectReference.ProjectId, projectId); - - CheckNotSecondSubmissionReference(projectId, projectReference.ProjectId); - - var oldProject = this.GetProjectState(projectId); - var newProject = oldProject.AddProjectReference(projectReference); - - return this.ForkProject(newProject, withProjectReferenceChange: true); - } - /// /// Create a new solution instance with the project specified updated to include /// the specified project references.