Reputation: 11
I have a solution with multiple c# projects the .editorconfig is working fine except for one Project.
The csproj file of the effected project is the is the legacy csproj formate.
I tried:
Upvotes: 1
Views: 33
Reputation: 11
I could solve my problem by editing the csproj file
moved the line
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
which where before the first
<ItemGroup>
to the end of the file.
After this the .editorconfig where applied corectly.
Unfortunately I have no idea why this had the desired effect but since it tock much time to fine out I hope it help some one. And maybe some one knows the reason for this.
===================================================
I Reproduced the behaviour in a new project using VisualStudio 2022
Create a Empty Solution
Add a new Class Library (.NET Framework)
Add a .editorconfig
file with some rules (e.g. Naming)
(Test) => error is shown (in my case IDE1006)
Unload the new Project and edit the csproj by moving the line
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
up before the first <ItemGroup>
Reload now the .editorconfig
is ignored (IDE1006 disappeared)
I do not understand why the order where changed in the old Project but at least this is how it can be reproduced.
Upvotes: 0