Posts

VisualTreeChanged Error when Debugging VSIX

I just had an odd thing happen. I tried to debug a VSIX project in VS 2015. When I ran it, I got an error that said: Message: An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationCore.dll Additional information: The visual tree has been changed during a 'VisualTreeChanged' event. At first, I thought it might be related to the issue VS 2017 caused with VSIX projects . But this was a different error. After Googling, I discovered here that you could fix it by disabling Enable UI Debugging Tools for XAML. Tools --> Options --> Debugging --> General --> Uncheck Enable UI Debugging Tools for XAML.

VSIX Winforms Toolpane

Image
The other day I wanted to create a Visual Studio Toolpane window and I wanted to create it using Winforms (by default, the toolpanes use WPF). After much research, I got it to work. These are the steps I followed: I've tested these steps with Visual Studio 2015 & Visual Studio 2017. Create a new Extensibility project In Visual Studio, from the File menu, select New --> Project. In the New Project dialog, one the left, under Visual C# , select Extensibility . On the right, select VSIX Project . Give the project a name. In this example, I'm calling it MySampleVSIXProject Add a Visual Studio Package Right-click the project in Solution Explorer and select Add --> New Item In the Add New Item dialog, on the left, expand Extensibility and select VSPackage . On the right, select Custom Tool Window . Give the tool window a name. In this example, I'm calling it MySampleToolWindow.cs Add a W...

Visual Studio 2015 VSIX Project Stopped Working

Yesterday I opened up a VSIX project to add a new feature. This is a Visual Studio 2015 project that I hadn't worked on in a few months. It worked fine a few months ago, but now, all of the sudden, it wouldn't build. What's going on? The error message I was getting stated: "Cannot find wrapper assembly for type library "EnvDTE100". Verify that (1) the COM component is registered correctly and (2) your target platform is the same as the bitness of the COM component." After Googling, I found from this site that if you install Visual Studio 2017 on your machine, it will affect your references to the EnvDTE assemblies. I had recently installed VS 2017. Thankfully, the site also contained the solution: "In old VSIX projects: Remove old COM references to EnvDTE, EnvDTE80, EnvDTE90 and EnvDTE100. Add new references using Assemblies | Extensions tab and select EnvDTE, EnvDTE80, EnvDTE90, EnvDTE100. The project should build now." I updated ...

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.

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

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-bi...

“Semicolon Mode”

Image
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’”.