Could 'Web Access' be hidden for untracked sources?
Closed this issue · 8 comments
probably need to extract stuff from MSBuild evaluation if available, or the binlog (if we're dealing with a binlog)
I'm looking at a binlog and EmbedUntrackedSources does not appear in any targets. It is read by https://github.com/dotnet/sourcelink/blob/main/src/SourceLink.Common/build/Microsoft.SourceLink.Common.targets, but it's not something that it looks like SDK tracks out of the box. We'd need the SDK to be able to say "I did this" when it creates things under obj
in a way that we could tell them apart from normal source files, and it doesn't look like it does. That wouldn't scale nicely to third-party stuff either.
What if we just make the rule that anything under IntermediateOutputPath gets no Web Access link?
Sounds reasonable
@KirillOsenkov Do you happen to know how to extract this from MSBuild evaluation in ProjectGenerator which uses Microsoft.CodeAnalysis.Project?
Unfortunately I don't think MSBuildWorkspace exposes any direct access to the MSBuild evaluation and the results of design-time builds. We may need to evaluate separately to retrieve this info, and that opens a whole 'nother can of worms.
Here's an old sample on how to do evaluation:
https://github.com/KirillOsenkov/MSBuildTools/blob/8ce8b1d1f88346726822b5160ba0c478d680fce5/src/MSBuildDumper/MSBuildDumper.cs#L17
But this might slow down the tool significantly. Also need to properly dispose of these to not leak memory. It's all a bit tricky unfortunately. I also recently wrote this quick overview doc: https://github.com/KirillOsenkov/Bliki/wiki/Quick-overview-of-MSBuild
Basically all I'm saying is we need to be careful otherwise we'll accidentally write a project system here :) Maybe worth looking if we should switch to Buildalyzer from MSBuildWorkspace, I haven't investigated this.
Need to decide whether all of this is even worth the trouble in the first place.
How bad would it be to hide Web Access
based on whether the file is underneath an obj
folder? That will align with 99.9% of the gitignores out there, I think.
That's a good tactical solution, I think we can just do that.