Open jimmylewis opened 2 years ago
This appears to be an error in the build targets that include .editorconfig and .globalconfig files. While .editorconfig files should be included from the parents of all source files included in the compilation, .globalconfig should only be included from the ancestor directories of the project file location itself.
@mavasani to coordinate the fix here
It seems to me though that any means of including the same config file twice should not cause it to cancel itself out. This part specifically seems like an undesirable behavior in any circumstance.
Key was set by the following files: 'D:\src\WebTools\src\Languages.globalconfig, D:\src\WebTools\src\Languages.globalconfig'
That question would be answered at the same time. However, note that if the issue I mentioned is fixed, the duplication problem never would have occurred, so it may not be a problem in the end.
@chsienki
Version Used: VS Version 17.3.0 Preview 1.0 [32403.30.main]
Steps to Reproduce:
Expected Behavior: all test projects will build without issues
Actual Behavior: build fails on the project with the linked files, as the linked files bring in src\Languages.globalconfig on their own. This results in a duplicate entry passed to the compiler: which in turn leads to all rules in that file being cancelled out by their own duplicate, e.g.
(Note the file names are the same)
Workarounds: Option 1: Don't use Directory.Build.props to centralize this. The extra .globalconfig must be added to each test project individually that does not contain a linked file from the src tree. This is a pain as it has to be maintained on each project based on whether they contain linked files. Option 2: Don't use the file name
.globalconfiguration
to avoid auto-detection. Use a different name and set @(GlobalAnalyzerConfigFiles) in both of the Directory.Build.props (src\Languages and test\Languages). This will avoid picking up the originating config. This is less painful as it can still be accomplished via Directory.Build.props