Getting CA1813 error after upgrading VS 2019

James J 586 Reputation points
2021-01-06T11:58:01.23+00:00

We have upgraded our application from VS 2017 to VS 2019. After that when we compile the code getting the below error which we do not see any issues in VS 2017.

Why are we getting this?

Compilation Error Details:
MSBUILD : error CA1813: Microsoft.Performance : Seal 'CppInlineNamespaceAttribute', if possible.

d:\agent_work\3\s\src\vctools\crt\managed\xmd\msvcmrt\predefined C++\CLI attribute types (compiler internal)(34): error CA1801: Microsoft.Usage : Parameter 'A_0' of 'CppInlineNamespaceAttribute::CppInlineNamespaceAttribute(String^)' is never used. Remove the parameter or use it in the method body.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,193 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 31,246 Reputation points Microsoft Vendor
    2021-01-07T02:28:21.113+00:00

    Hello @James J ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    Please refer to Manish Vasani’s explanation in this thread C++/cli compiler causing FxCop errors, and try related suggestions:

    “Binary FxCop analysis is deprecated in favor of source based Roslyn analyzers. See Migrate from legacy analysis (FxCop) to source analysis(.NET analyzers) for more context”

    “As source based Roslyn analyzers are not supported on C++/CLI, code analysis for managed CA rules is no longer supported for C++/CLI. You should do one of the following:

    1. Turn off code analysis for C++/CLI projects by ensuring the MSBuild property RunCodeAnalysis is set to false in your project file.
    2. If you’d like to continue using the deprecated managed CA rules for C++/CLI projects, add inline source suppressions for such false positives.”

    Sincerely,
    Tianyu

    • 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

0 additional answers

Sort by: Most helpful

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.