I want to know how to suppress a specific compiler warning within VS Code for the entire project.
I have seen this queston: Is it possible to disable specific compiler warnings? but it is for Visual studio, not Visual Studio Code.
Here are the answers that where recommended in the question linked above:
1. Solution Explorer
> View
> Properties
> Build
> Suppress Warnings
and
2. #pragma warning disable warning-list
For #1: I can't find the Solution Explorer anywhere within VS Code.
For #2 This only works if I include it at the top of each of the scripts. I need a way to do so for the entire Project.
Updates:
I tried using <noWarn>01699,8019</noWarn
> in my .csproj files, but no go.
After reviewing the last changes, I noticed that it had reverted to <noWarn>0169</noWarn>
. I then realised that what I needed was <noWarn>0169;8019</noWarn>
. Switching the ,
for a ;
Solved the problem.
Well, it turns out that the above solution didn't work after all. As soon as I restarted VS Code, all the warnings came back. Maybe the error code I need isn't 8019, even though it worked as the error code within a #pragma
statement. Are the codes used within a <noWarn>
different than the codes used at the end of a #pragma
statement?
For those saying too switch to VS Community, that's not the point. I'm using VS Code AS a text editor with Unity Editor. I'm looking for which file I need to change and what changes need to be made to apply a statement like #pragma warning disable 8019
to the entire project.
I was able to get this to work. My solution looks something like this:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion>
<NoWarn>0169;8019</NoWarn>
</PropertyGroup>
<NoWarn>
is PascalCase rather than camelCase, and the element is nested inside of a <PropertyGroup>
.