msbuild
msbuild copied to clipboard
PublishDir global property making it's way down into dependent ProjectReferences
So, this isn't a regression, as far as I can tell. But it is a potential performance issue that might be able to be improved.
During a Publish target, generally the PublishDir property is passed. This property seems to make it down into the evaluation of the ProjectReferences. As such, combining it with other builds results in double evaluation of projects where I don't think it has to.
For instance, if the following command is executed: msbuild /t:ProjectA;ProjectA:Publish ProjectA.csproj /p:PublishDir, and ProjectA depends on a graph, containing, say, ProjectB, then ProjectB is invoked from the evaluation of ProjectA:Build as well as ProjectA:Publish, but the PublishDir property flows down into both. So though ProjectB isn't the one publishing, it ends up getting the property, and evaluating twice, once for each path.
I am suffering from this issue, I believe, because I have numerous projects which publish the output of the same project into different directories, in different ways. For instance, it might publish it for RID win7 and RID linux. Publishing it twice. But that only matters for ProjectA, not ProjectB. RuntimeIdentifier is removed. But the PublishDir property flows down. And of course I'm outputing win7 and linux into different output paths.
It might make sense to add PublishDir to GlobalPropertiesToRemove.
It looks like `Microsoft.NET.Sdk.Publish does something similar with "WebPublishProfileFile".