Don't know why I did, but I updated to .Net Core 2.1 yesterday. Ever since I updated, I am seeing tons of squiggly lines throughout my solution in Visual Studio on mac (so annoying). Here's the warning message -
I think understand the source of the warning. Basically, I am referencing to a lot of 3rd party Nuget packages (Autofac, Serilog, etc.) and they are built with an older version of .Net Core. This is what the warning is trying to tell me I think. But my code works just fine, don't have any issues running it.
After researching a little bit, I think the error is CS1701. It is also added [by default] to be ignored in the Compiler settings for all projects in my solution. This is why I am not seeing this warning reported when I build my project/solution. However, the squiggly's are still shown in the text editor in Visual Studio.
Visual Studio is kind enough to offer a solution to suppress these squiggly lines, by adding a pragma statement at the top of .cs
file - #pragma warning disable CS1701 // Assuming assembly reference matches identity
. But I am afraid I need to add this line to all .cs
file in my solution (there are a lot).
Does anyone know any other better way to suppress these squiggly lines in the text editor, please?
Goto Preferences->Text Editor -> Source Code Analysis -> Code Rules (tab) and change the line
Rule Id="CS1701" Action="Warning" to
Rule Id="CS1701" Action="Hidden"
and press OK.
Wait a for a short while and the lines will disappear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With