共用方式為


IVsSharedProjectReferencesHelper.ChangeSharedMSBuildFileImports Method

Definition

Changes the set of Shared MSBuild files imported by a project.

public:
 bool ChangeSharedMSBuildFileImports(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ importingProject, Array ^ importFullPathsToRemove, Array ^ importFullPathsToAdd, System::String ^ szImportLabel);
public bool ChangeSharedMSBuildFileImports (Microsoft.VisualStudio.Shell.Interop.IVsHierarchy importingProject, Array importFullPathsToRemove, Array importFullPathsToAdd, string szImportLabel);
abstract member ChangeSharedMSBuildFileImports : Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * Array * Array * string -> bool
Public Function ChangeSharedMSBuildFileImports (importingProject As IVsHierarchy, importFullPathsToRemove As Array, importFullPathsToAdd As Array, szImportLabel As String) As Boolean

Parameters

importingProject
IVsHierarchy

The project that is being modified.

importFullPathsToRemove
Array

A list of MSBuild project file full paths (e.g. *.projitems) that should be removed from being imported.

importFullPathsToAdd
Array

A list of MSBuild project file full paths (e.g. *.projitems) that should be added as imports.

szImportLabel
String

The label used to identify the MSBuild import statements of interest (e.g. Shared Project References use import statements with the label = "Shared").

Returns

True if the project has been reloaded, false if not.

Remarks

This method may cause the importingProject to be reloaded as part of this operation. If this method returns true that the project was reloaded, then the caller must get the project again by calling IVsSolution.GetProjectOfGuid or similar mechanism after this method returns. If any errors occur, then no changes will be committed to the project file on disk.

Applies to