Compartilhar via


ProjectCollection.UnloadProject Method

Definition

Removes a project root element from the project root cache.

Overloads

UnloadProject(ProjectRootElement)

Unloads a project XML root element from the weak cache.

UnloadProject(Project)

Unloads the specific project specified. Host should call this when they are completely done with the project. If project was not already loaded, throws InvalidOperationException.

UnloadProject(ProjectRootElement)

Source:
ProjectCollection.cs

Unloads a project XML root element from the weak cache.

public:
 void UnloadProject(Microsoft::Build::Construction::ProjectRootElement ^ projectRootElement);
public void UnloadProject (Microsoft.Build.Construction.ProjectRootElement projectRootElement);
member this.UnloadProject : Microsoft.Build.Construction.ProjectRootElement -> unit
Public Sub UnloadProject (projectRootElement As ProjectRootElement)

Parameters

projectRootElement
ProjectRootElement

The project XML root element to unload.

Exceptions

Thrown if the project XML root element to unload is still in use by a loaded project or its imports.

Remarks

This method is useful for the case where the host knows that all projects using this XML element are unloaded, and desires to discard any unsaved changes.

Applies to

UnloadProject(Project)

Source:
ProjectCollection.cs

Unloads the specific project specified. Host should call this when they are completely done with the project. If project was not already loaded, throws InvalidOperationException.

public:
 void UnloadProject(Microsoft::Build::Evaluation::Project ^ project);
public void UnloadProject (Microsoft.Build.Evaluation.Project project);
member this.UnloadProject : Microsoft.Build.Evaluation.Project -> unit
Public Sub UnloadProject (project As Project)

Parameters

project
Project

The project to remove.

Remarks

The host should call this method when it no longer needs the project.

Throws InvalidOperationException if the given project is not present in the project collection.

Applies to