format
format copied to clipboard
IDE0051 / IDE0052 / IDE0005 issues with 7.0.302 and dotnet format --verify-no-changes
With the recent upgrade to 7.0.302, dotnet format --verify-no-changes
seems to now be reporting IDE0051
and IDE0052
errors incorrectly in my project.
I'm using Blazor with code behind files and several private
members are declared in the code behind file (Foo.razor.cs) but only used in the markup file (Foo.razor).
dotnet format --verify-no-changes
also seems to be reporting errors for IDE0005
(using unnecessary) in a razor code behind file, but the using is necessary.
i have the same issue
We are seeing the same issue on 7.0.304, but only on Azure CI (using DotNetCoreCLI@2). Locally it works fine somehow....
Edit: we figured it out:
- enabled --verbosity diag when calling "dotnet format"
- we noticed that one of the Nuget packages we depend on was complaining about missing .Net 6 (we are moving to .Net 7). It seems this particular package is not built as self-contained and it has some instructions in .targets that call a tool. All tagged using directives were about namespaces in this particular package.
- we added an additional UseDotNet@2 task to install the .Net 6*runtime (not SDK) and now everything works correctly for us
Locally if worked because devs usually have multiple .Net SDK installed.