Disable Code Analysis on Test Projects

WILLIAM BEHNING 36 Reputation points
2021-02-23T16:35:24.447+00:00

I followed the instructions from Microsoft to turn off Code Analysis on test projects. Yet I continue to get analysis messages for these projects.

https://learn.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2019

For example:

Severity Code Description Project File Line Suppression State
Message IDE0017 Object initialization can be simplified MyProj.Tests C:\Projects\MyProj.Tests\UnitTest1.cs 43 Active

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,183 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
351 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. David Lowndes 4,716 Reputation points
    2021-02-23T16:48:54.783+00:00

    In Solution Explorer, select your project, expand the Dependencies, Analyzers branch. select the ones you'd prefer not to see, right click and change the severity.

    0 comments No comments

  2. Dylan Zhu-MSFT 6,421 Reputation points
    2021-02-24T05:48:20.073+00:00

    Hi WILLIAMBEHNING,

    You can try to select Microsoft Managed Minimum Rules or customize an empty ruleset.

    71421-image.png

    Best Regards, Dylan

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.