dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

SDK resolvers should have an API to clear state #9164

Open jeffkl opened 1 year ago

jeffkl commented 1 year ago

SDK resolvers have caches because they depend on certain things such as files on disk to determine paths to SDKs. In order to make the cache more effective, SDK resolvers can make these caches static so they can be re-used by evaluations within the same process, especially Visual Studio. However, a long lived process like devenv.exe can cause these caches to potentially grow. It would be good if MSBuild had an API that could tell SDK resolvers to clear their state. For example, in Visual Studio when you close a solution, the SDK resolvers' caches could be cleared.

AR-May commented 5 months ago

Team triage: @baronfel what do you think?

baronfel commented 5 months ago

This seems like a good thing to have - it appears we designed the resolver mechanism with relatively short lived clients in mind, but VS (and the MSBuild Server Daemon) are a different use case entirely.