I recently started working on a project with an SQL 2012 server database project. To target SQL 2012 I had to install SQL Server Data Tools or SSDT. If you haven't already had a chance to look into SSDT then you may not know that with SSDT .dbproj files (Visual Studio Database Projects) have been replaced by .sqlproj files (SQL Database Projects). The new project file type allows you to target all SQL server versions including 2012. Sqlzapper did a nice post on the key differences between the two and helped me understand better how builds and deployments work with in SSDT.
With Visual Studio Database Projects you could use VSDBCMD.EXE to deploy your database project using the Post-build event command line in your project properties.
So, I needed to figure out how to do this with SQL Projects as my build was failing miserably doing the way you would with Database Projects. The docs on MSDN tell you how to publish a database project using the 'Publish Database' dialog (like one-click publish). Although this method works its not ideal in situations were you want to automate your publish on build to satisfy some dependencies, or if your lazy and don't want to right-click and deploy each time ;) Unfortunately, I couldn't find how to automate the publishing of the database. After reading sqlzapper's post I realized that I needed to use SQLPACKAGE.EXE to publish my database in the Post-build event command line instead of VSDBCMD.EXE.
I just showed you how to deploy your database using the Post-build command line. Looking at the images there is a lot to be explained, such as the new tabs in the project properties and .dbschema file extension from the database project vs. the .dacpac file extension from the SQL database project (in the Post-build event scripts). Check out sqlzapper's post and the other links I provided above to learn more about them.
I'm a huge supporter of clean coding (writing good code using principals, patterns and practices). Below is a list of some must have extensions for visual studio to help you code better and write cleaner code.
Resharper is a developer productivity tool that enhances VS with a bunch of features to make you more productive. Not only that, Resharper helps you adhere to basic coding standards thru powerful code editing helpers and code generators, and helps eliminate errors and code smells, which ultimately lead to cleaner code. Some of my favorite features include:
If your practicing clean coding and are programming to interfaces (like you should be) instead of concrete implementations, then I highly recommend Agent Mulder. Although Agent Mulder is not actually a VS extension (its actually a plug-in for Resharper), it integrates nicely with VS and Resharper to see your dependency injection container's registrations and help you navigate them.
Agent Ralph is another Resharper plug-in. This plug-in will help you keep your code DRY (Don't Repeat Yourself) by scanning your code and detecting functional duplicates, and offering the appropriate method to replace the offending code.
[caption id="attachment_392" align="alignnone" width="550"] Agent Ralph detecting duplicate functional code[/caption]
GhostDoc is an awesome extension that automatically generates XML documentation comments for methods and properties. If your practicing clean coding techniques then you know your documentation is your code (prose). This is not always acceptable, especially in the enterprise, so if your going to be documenting in code, then automate it so its consistent. The added benefit of this extension is that it will make you name your methods and parameters better since it uses those names in the documentation.
[caption id="attachment_393" align="alignnone" width="585"] GhostDoc XML Documentation[/caption]
Like Resharper, this one is packed with features. Some features overlap with Resharper so you may want to take a look at the settings after installing to turn them off. Some of my favorite features:
Custom Document Well that allows you to change the behavior of document tabs, including the ability to sort tabs alphabetically or by project
Format Document on Save
Email Code Snippet and HTML Code Copy
Align Assignment statements
[caption id="attachment_396" align="alignnone" width="672"] Productivity Power Tools 2012 options[/caption]
The Team Foundation Server Power Tools extension is a very powerful and handy tool if you use TFS. Basically, its a set of tools and utilities that enhances TFS by exposing some of its features to VS and windows. For example, the tool provides an Alert explorer that provides a GUI to subscribe to alerts based on different scenarios and exposes a TFS context menu that can be used in Windows Explorer. In addition, the tool improves your teams use of TFS thru Custom Check-in Policies and a Best Practices Analyzer.
[caption id="attachment_397" align="alignnone" width="775"] TFS Power Tools context menu[/caption]
[caption id="attachment_398" align="alignnone" width="851"] TFS Power Tools Best Practices Analyzer[/caption]
Well thats it. I didn't mention it earlier, but Resharper will set you back about a $100 bucks; professionally, its a great investment. All the other extensions are free!
Any recommendations? Something I might have missed? Let me know.