Custom SQL Code Analysis Rules Deployment in Visual Studio 2022

Christopher Lutz 0 Reputation points
2023-03-30T16:06:56.22+00:00

Thank you in advance for your help.

I have a series of custom SQL Code Analysis Rules that I authored that work fine in Visual Studio 2019. After upgrading to Visual Studio 2022, the custom rules are no longer appearing.

  • In VS2019, the custom rule assemblies were deployed to the various extension folders. For example C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\Extensions
  • I have tried deploying the rules to a number of different locations, both in the AppData and Program Files locations for VS2022
  • I have not be able to locate any information regarding any changes in VS2022 for custom SQL rules such as a new deployment location, VSIX package configuration, or if they are even still supported.

For reference I used this article as a reference when originally creating the set of rules

https://learn.microsoft.com/en-us/sql/ssdt/walkthrough-author-custom-static-code-analysis-rule-assembly?view=sql-server-ver16

The documentation refers to older versions of Visual Studio, but make no mention of VS2022.

Is there any updated documentation available for VS2022 SQL Code Analyzer development or if custom rule extensions are still supported? Thanks.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,690 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,436 Reputation points
    2023-03-31T06:37:24.8666667+00:00

    Hi @Christopher Lutz,

    In VS 2022, the path should be like:

    C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\SQLDB\DAC

    After upgrading to Visual Studio 2022, the custom rules are no longer appearing.

    If this does not solve your problem, you can ask the question again on the feedback page.

    https://developercommunity.visualstudio.com/VisualStudio/report?entry=problem

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


  2. Christopher Lutz 0 Reputation points
    2023-04-07T19:23:17.04+00:00

    Finally was able to get it to work This is what I ended up needing to do is the following

    1. Target Framework of 4.8 for the Rules DLL
    2. Any CPU as the "Platform Target"
    3. Reference only the Microsoft.SqlServer.DacFx version 150
    4. I left the assembly as unsigned

    Deployted the assembly and dependencies to the following directory C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\Extensions\150

    0 comments No comments