Search code examples
c#visual-studiocode-cleanup

Code Cleanup in Visual Studio 2022 For One Solution Only


I have some separated solutions in my hard disk. And I have configured my Visual Studio 2022 like this: enter image description here

But one of them (the oldest one) does not follow the configuration. This is what happens, after applying Code Clean-up, even if the method was expression-bodied:

enter image description here

Note: I have not .editorconfig in solution folder (in hard and solution explorer)

I want my solution to follow my configuration as the other solutions.


Solution

  • I finally found why is that happening. Actually I don't know why. But now, I know how to fix it. All I had to do was commenting the following line in .csproj file:

    <!--<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>-->
    

    And done!!!