Merely evaluating a Project (even in a private ProjectCollection) that produces an ProjectCachePlugin item has the nasty side-effect of impacting the next build, even though that project is never built.
And in particular, it breaks attempts to programmatically enable the MSBuildCache plugin because it is very particular about only being initialized once, yet it is loaded twice in my testing because MSBuild allowed a single evaluation of an isolated project to also impact the build.
Steps to Reproduce
This code breaks the next build, yet is a natural way to reuse the plugin's defaults as defined in the plugin's nuget package:
Another instance of MSBuildCache is already running in this build. This is typically due to a misconfiguration of the plugin settings, in particular different plugin settings across projects.
Analysis
@dfederm says msbuild stores the plugin in a mutable static (evil) just from seeing an ProjectCachePlugin item in any project evaluation.
Issue Description
Merely evaluating a Project (even in a private
ProjectCollection
) that produces anProjectCachePlugin
item has the nasty side-effect of impacting the next build, even though that project is never built. And in particular, it breaks attempts to programmatically enable the MSBuildCache plugin because it is very particular about only being initialized once, yet it is loaded twice in my testing because MSBuild allowed a single evaluation of an isolated project to also impact the build.Steps to Reproduce
This code breaks the next build, yet is a natural way to reuse the plugin's defaults as defined in the plugin's nuget package:
Expected Behavior
A successful build.
Actual Behavior
The build fails with this message:
Analysis
@dfederm says msbuild stores the plugin in a mutable static (evil) just from seeing an
ProjectCachePlugin
item in any project evaluation.Versions & Configurations
Dev17.12 (35228.240.main)