
Unloading Projects, Caching, and Retrieving Results
In earlier versions of MSBuild, projects remained in memory after they were built. MSBuild 3.5 introduces a task property named UnloadProjectsOnCompletion, which lets you remove a project from memory after it has completed building.
However, when a project has been unloaded from memory, it cannot be reloaded in the same build instance. Because a build often has targets that must be called to gather information in a project, unloading a project from memory during a build may cause problems. To resolve this, MSBuild 3.5 introduces another property named UseResultsCache, which can be used to cache the target results (for example, build results, items, and properties) of all projects that are being built.
Because a project occupies more memory than its build results, unloading the project but retaining its results is a more efficient use of memory. UnloadProjectsOnCompletion and UseResultsCache work together to improve build performance not only by freeing memory, but also by enabling MSBuild to retrieve build results directly from memory instead of files on disk.