Share via


Solution.WithProjectReferences 方法

定义

使用指定的项目创建新的解决方案实例,以包含指定的项目引用列表。

public:
 Microsoft::CodeAnalysis::Solution ^ WithProjectReferences(Microsoft::CodeAnalysis::ProjectId ^ projectId, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::ProjectReference ^> ^ projectReferences);
public Microsoft.CodeAnalysis.Solution WithProjectReferences (Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference> projectReferences);
public Microsoft.CodeAnalysis.Solution WithProjectReferences (Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ProjectReference>? projectReferences);
member this.WithProjectReferences : Microsoft.CodeAnalysis.ProjectId * seq<Microsoft.CodeAnalysis.ProjectReference> -> Microsoft.CodeAnalysis.Solution
Public Function WithProjectReferences (projectId As ProjectId, projectReferences As IEnumerable(Of ProjectReference)) As Solution

参数

projectId
ProjectId

要替换为 projectReferences的引用的项目的 ID。

projectReferences
IEnumerable<ProjectReference>

新项目引用。

返回

例外

projectReferences 包含 null

projectReferences 包含重复项。

解决方案不包含 projectId

适用于