Open srivatsn opened 7 years ago
I assume this doesn't happen anymore because roslyn stopped setting the subtype for CPS projects?
Yes, it would have stopped but we'll need a long solution for this.
There are a couple of distinct problems in play.
<SubType>
metadata is very slow in CPS.Strictly speaking this issue is only about the first problem.
System.ComponentModel.Component
exists in net46
but not netstandard1.5
, which is why the preprocessor is being used to only include the file contents when targeting net46
. However, the SubType
metadata applies to the file as a whole, not to an individual class. The Designer attribute scanner processes this file once for each target framework, and for net46
it determines that the file should have <SubType>Component</SubType>
and for netstandard1.5
it should have <SubType>None</SubType>
(which is the default so the subtype ends up being removed entirely). So each scan twiddles the metadata, changing the project file for both targets, which kicks off more scans, and more twiddling, and so on.
I see several possible solutions and mitigations:
<SubType />
metadata is set. Only if they all agree that it is not would the metadata be removed. We would need to figure out what to do if different targets want different values for the metadata--one value would need to win consistently.<SubType />
one way or the other.Note these options are not mutually exclusive. At the minimum we should implement 3 anyway as it avoids pointless scans.
Reported here - https://developercommunity.visualstudio.com/content/problem/38882/project-that-targets-both-net46-and-netstandard15.html
Version. Visual Studio 2017 RTM. All extensions disabled.
As a result, the project and any other projects referencing this project are constantly recompiling.