How can I get format warning on the console?
I'm developing a .NET C# application for Linux and I was wondering if there's some way to get the warning I get on vscode like
Remove unused parameter 'Sender'IDE0060
or Name can be simplified IDE0002
on the console? I tried with dotnet format
and dotnet format analyzers
but those didn't printed any of those warning and they didn't fix them either.7 Replies
Probably it expect you to change it's name to "_" because it's unused
I don't know about vsc stuff tbh
Prefer VS over VSC
Yeah I get that, but I'm looking for a way to see those warnings from the console :/
Same but I'm on Linux now and for some reason debugging on Rider doesn't work so I'm stuck with vscode
oh damn
https://github.com/dotnet/roslyn/issues/6195 gives some context on the history of this
GitHub
IDE rules don't fail builds · Issue #6195 · dotnet/roslyn
When using code analysis with the IDE rules under Microsoft.CodeAnalysis.CSharp.Features enabled and their action set to Error, if one of the rules is violated, I correctly get the error message, h...
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#analysislevel I believe is what you need to set
MSBuild properties for Microsoft.NET.Sdk - .NET
Reference for the MSBuild properties and items that are understood by the .NET SDK.
Specifically
EnforceCodeStyleInBuild
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#enforcecodestyleinbuildMSBuild properties for Microsoft.NET.Sdk - .NET
Reference for the MSBuild properties and items that are understood by the .NET SDK.
That worked, thanks!