4

Currently .sqlproj files have 15 code analysis rules (SR0001 to SR0015). I would like to create my own code analysis rule to make sure that columns used in where clauses are indexed.

How would I extended the current .sqlproj code analysis so that I have a 16th (SR0016) custom code analysis rule.

Andrew Thompson
  • 2,396
  • 1
  • 21
  • 23

2 Answers2

4

Just noticed this.

Consider using SSDT Code Analysis Extensibility which has just been added back to SSDT and is available in the SSDT March 2014 release.

http://msdn.microsoft.com/en-us/library/dn632175%28v=vs.103%29.aspx (Visual Studio 2012 and 2013)

If you are using Visual Studio 2010 then visit: http://msdn.microsoft.com/en-us/library/dd172133%28v=vs.100%29.aspx (Visual Studio 2010)

Note the location you push your custom library to: http://wearedevs.blogspot.co.uk/2014/05/ssdt-march-2014-static-code-analysis.html

Also checkout http://dataidol.com/davebally/ssdt-tsql-smells-add-in/ (this will give you a leg up)

brumScouse
  • 3,166
  • 1
  • 24
  • 38
0

I followed the blog post.. the build was okay but I got run-time error. Meaning it gives me - "Exception has been thrown by the target of an invocation" and I cannot even create a DB Project in VS. When I remove the dll from the VS extension folder everything is fine.

Sam
  • 87
  • 1
  • 3