简体   繁体   中英

How can we extended SQLProj code analysis rules by adding our own custom rule?

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.

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM