Tuesday, May 9, 2017

Deleting Files in Visual Studio/TFS Taking a Long Time

I needed to delete some files from source control and noticed that it was taking Visual Studio/TFS about 30 seconds to delete a file (move it to the delete pending list). Since I needed to delete a lot of files, you can imagine how annoying this was. So, I fired up good old Process Monitor and started watching devenv.exe. Then I went into Source Control explorer and deleted a file. Suddenly Process Monitor was full of folder accesses. Dozens of folders were being scanned. After some research, it turned out that when I deleted a file for some reason Visual Studio was looking through all the folders in the same workspace as the file.

So, I created a new workspace and put my project and only that project in the workspace. Now when I try to delete a file it happens very quickly.
Lesson learned.

Thursday, August 11, 2016

More Quotes I Like

Here's some more quotes I've run across that I like: 

"The faster a program converts a task from not-finished to finished, the happier the user will be." -- unknown

"The only value that your software ever has or ever will have is the degree to which it increases the happiness of its users." -- unknown

"You don't want to not have problems. You want to have better problems." -- John Sonmez

Monday, May 2, 2016

Creating a new SSMS Ecosystem Project Plugin

I recently wanted to create an SSMS plugin so I was happy to run across Red Gate’s SSMS ecosystem project. It comes with the C# code for a sample plugin, which is nice. But I couldn’t find any documentation on how to setup a new plugin from strach. It wasn’t hard to figure out though.

One Time Setup

The first thing you need to do is to install the Red Gate SSMS Ecosystem Framework. This only has to be done once – it doesn’t have to be repeated for every plugin you write.

Each Time Setup

Here are the steps to follow in Visual Studio for every plugin you create:

1) Create a new Class Library

2) Search Nuget for “Redgate SSMS” and install the RedGate.SIPFrameworkShared package.

3) Rename Class1 to something more fitting.

4) At the top of your code add “using RedGate.SIPSharedFramework”.

5) Create a registry entry for your plugin. The location will depend on whether you’re running a 32-bit or 64-bit version of Windows.

32-bit: HKLM\SOFTWARE\Red Gate\SIPFramework\Plugins

64-bit: HKLM\SOFTWARE\Wow6432Node\Red Gate\SIPFramework\Plugins

At this location create a new String Value. Name it the name of your plugin. Then make the value the path to your project’s dll.

6) Modify your class to inherit from ISsmsAddin4

7) Implement the members of this interface. 

    public class MyPlugin : ISsmsAddin4
        public string Version { get { return ""; } }
        public string Description { get { return "Your add-in's description"; } }
        public string Name { get { return "Your add-in's name"; } }
        public string Author { get { return "Plugin Author"; } }
        public string Url { get { return @"https://example.com"; } }

        public void OnShutdown()
            // Your code here

        public void OnLoad(ISsmsExtendedFunctionalityProvider provider)
            // Your code here

        public void OnNodeChanged(ObjectExplorerNodeDescriptorBase node)
            // Your code here 


8) Using the code Red Gate’s sample add-in as your guide, you can now begin to create your plugin.

See the Red Gate website for more information on debugging your plugin.

Friday, March 25, 2016

“Semicolon Mode”

I think I coined a new term this week.

Several C-like languages (C#, Javascript, Objective-C, etc.) end statements with a semicolon. Other languages (Visual Basic, Python, etc.) don’t.

I had been writing some C# for a while and switched over to work on a Visual Basic project. I found myself putting semicolons at the end of the VB lines and said to myself: “Hey, I’m still in ‘Semicolon Mode’”. Smile

Saturday, March 19, 2016

Parsing .NET Connection Strings

Have you ever wanted to get a piece of a connection string? Like say the database? There’s no need to grab IndexOf and Substring and try it parse it yourself. .Net already has the ability to parse connection string using the StringConnectionBuilder:
using System.Data.SqlClient;
var conString = "Server=myServerAddress;Database=Customers;User Id=tim;Password=lassie;";
var s = new SqlConnectionStringBuilder(conString); var datasource = s.DataSource;   // "myServerAddress" var database = s.InitialCatalog; // "Customers" var username = s.UserID;         // "tim" var password = s.Password;       // "lassie"

Friday, March 4, 2016


I’ve been working a lot with Sql Server Management Studio (SSMS) lately and thought I’d share some tips I’ve ran across to make it easier to use.

1) Change the number in Select & Edit.

When you right-click on a table in SSMS two of the options you are given are “Select Top 1000 Rows” and “Edit Top 200 Rows”. You can change these numbers. To do so, select Tools –> Options in the menu. In the Options dialog select “SQL Server Object Explorer”. Under Table and View Options you can change the default values.


2) Change the connection color

You can change the color at the bottom of the query window based on the database you are connected to. On the connection dialog select “Options >>”. Then select the “Use custom color” dialog and use the “Select” button to pick a color. Now when you’re connected to the database, the bottom of the query editor window will be the color you selected. I like to set my TEST database to green and the PROD database to red.


3) Change the Edit Rows Query

When you right click on the table and select “Edit Top 200 Rows” you are given these rows to edit. But wouldn’t it be nice if you could change the WHERE clause to show just the records you want? Well you can. First select “Edit Top 200 Rows”. Then from the menu, select Query Designer –> Pane –> SQL. Here you can edit the SQL that returns the records for editing. Once you’ve edited it, right-click on the query window and select “Execute SQL”. Now you can edit just the rows you selected.

Saturday, February 27, 2016

Quotes of the Week

Here are some interesting tech quotes I ran across this last week.

“Past you is always the worst enemy of any programmer.” –John Siracuse, Accidential Tech Podcast, Episode 156

“Good design makes users more effective” –About Face, 4th ed. Page 16

“As funny as you might see it, successful software is a nice and effective UX on top of some magical black box” –Dino Esposito, MSDN Magazine, February 2016