dotnet/msbuild

ProjectCachePlugin cannot be used outside of VS?

xoofx opened this issue · 2 comments

xoofx commented

Hey,
I have been trying to rely on ProjectCachePluginBase from a build server, but when submitting build to a different node, the ProjectCachePluginBase that was instantiated in the server is not propagated to the msbuild nodes.

Also, looking at that code:

if (BuildEnvironmentHelper.Instance.RunningInVisualStudio)
{
// TODO: Remove this when VS gets updated to setup project cache plugins.
CollectProjectCachePlugins();
}

It seems that even If I wanted to try to inject the plugin via a ProjectCachePlugin item to the other msbuild nodes, I would not still be able to do it.

Anything I'm missing or this is something not possible today?

Instead of checking for VS, couldn't we check for an env variable or a property passed to msbuild?

This particular bit is quite annoying, as I'm gonna need to fork somehow MSBuild to achieve this... I have more questions/suggestions with caching, but I will open another issue.

cc: @KirillOsenkov

Instead of checking for VS, couldn't we check for an env variable or a property passed to msbuild?

This particular bit is quite annoying, as I'm gonna need to fork somehow MSBuild to achieve this...

Please don't fork for this :). We can take a patch that adds || trait-check that goes back to an environment variable. IIRC we didn't want to expose a command-line argument for this because that would be hard to deal with in VS (without changes on the VS side) but I don't think that's a strong long-term commitment.

xoofx commented

Please don't fork for this :).

hehe, no worries, I was saying this just for making my prototype, really don't plan to fork msbuild for the rest of my life. 😅

I'm gonna hack around first, as I have also other hacks related to static-graph/isolated and project caching that I can't express with the current API, and then I will come back to you, likely will need a meeting (but I will schedule that from the email thread I sent last week)