How can I disable a specific warning for a C# project in VS2012?

前端 未结 6 455
既然无缘
既然无缘 2020-12-20 11:45

I am trying to generate partial XML documentation during my build process for a C# project in VS2012. When I check the XML documentation file option in Project->Properties->

相关标签:
6条回答
  • 2020-12-20 11:56

    Try adding _ALLOW_KEYWORD_MACROS to Current Property Pages, Your Project, C/C++, Preprocessor, Preprocessor Definitions

    0 讨论(0)
  • 2020-12-20 12:06

    It's in the same place as Visual Studio 2010. In the project properties, on the Build tab, called Suppress warnings.

    0 讨论(0)
  • 2020-12-20 12:09

    The warning you're getting has a number (e.g. CS2000), so what you need to do is right-click on the project, go to the Build tab, and add that warning to the Suppress warnings text box. You can subsequently suppress more than one by separating them with a comma (e.g. CS2000,CS2001).

    0 讨论(0)
  • 2020-12-20 12:13

    For the project level go to Project -> Properties -> Build tab

    enter image description here

    If you want to disable the warning to some code section, try this :

    #pragma warning disable XXX,XXX
                //your code 
    #pragma warning restore XXX,XXX
    

    Read about #pragma warning

    0 讨论(0)
  • 2020-12-20 12:13

    Just add NoWarn block in the csproj:

    <PropertyGroup>
     <NoWarn>1998;1999</NoWarn>
    </PropertyGroup>
    
    0 讨论(0)
  • 2020-12-20 12:15

    You can open the project properties and enter comma separated warning numbers you want to suppress into the Suppress Warnings textbox on the Build tab.

    0 讨论(0)
提交回复
热议问题