Browsing on codeproject

Codeproject is a tremendous ressource to provide some good examples on how to deal with certain problems/technologies. For that matter, you usually would want to download the sample-code provided by the author and just go right to the source.

This typically involves a number of repetitive steps: browse to the article, download the source, unzip it to a unique directory, open it with Visual Studio and finally review the code with the article.

I just stumbled across a knowledge-base entry, which originally dates back to 2007. This article introduces a codeproject browser extension to visual studio. So now you can just download the source from within visual studio jump to the project and reference back to the article – all without leaving Visual Studio – this is cool.

Integrated WSPBuilding

So after figuring, that the WSPBuilder is actually representing the good I fully embraced it.

To take it to the next level, I installed the Visual-Studio extensions (not only to increase the number of plugins, but this is a nice side-effect; [pluginCount++]). Unfortunately this wasn’t very cooperative to work with my german version of Visual Studio.

So after some frustration I came across an according issue and tried the proposed alternative WSPTools.VisualStudio.VSAddIn.dll – and what should I say – it actually works!

So now I’m actually waiting for this to be merged into the release of the WSPBuilder.

(happy WSPBuilding …)

Show them keys

If you’re a keyboard-shortcut-junkie just like me, you want to have all your currently assign keybindings memorized … but there’s a way to supply you some kind of cheat.

With this little macro you can list all currently active keybinding of visual studio:

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module KeyboardShortcuts
Function GetOutputWindowPane(ByVal Name As String, Optional ByVal show As Boolean = True) As OutputWindowPane
Dim window As Window
Dim outputWindow As OutputWindow
Dim outputWindowPane As OutputWindowPane
window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
If show Then window.Visible = True
outputWindow = window.Object
outputWindowPane = outputWindow.OutputWindowPanes.Item(Name)
Catch e As System.Exception
outputWindowPane = outputWindow.OutputWindowPanes.Add(Name)
End Try
Return outputWindowPane
End Function
Sub ListCommands()
Dim outwin As OutputWindowPane = GetOutputWindowPane("List Commands", True)
For Each cmd As Command In DTE.Commands
Dim bindings() As Object
bindings = cmd.Bindings
For Each binding As String In bindings
outwin.OutputString(cmd.Name.ToString() + vbTab + binding + vbCrLf)
End Sub
End Module

Activating the WSPBuilder context menu

Recently WSPBuilder caught my attention, and I started to play a little with the command-line tool. WSPBuilder dramatically eases the creation of WSP-Files to deploy SharePoint solutions.

But even more interesting would be an integration into Visual Studio – and since I’m not the first one to recognize this need there is already an addin.

Unfortunately the menu-extension is not visible on my german installation of Windows (and Visual Studio). So there is some manual work needed:

  • copy the WSPTools.VisualStudio.VSAddIn.AddIn from C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\MSEnvShared\Addins to C:\Dokumente und Einstellungen\All Users\Application Data\Microsoft\MSEnvShared\Addins.
  • startup Visual Studio and make sure the addin is being started by checking the appropriate check-box.

IntelliSense for MSBuild community tasks

OK, you probably know it by now … there is a whole lot of stuff writte in nice angle-brackets, but there is way to little intellisense support for all this.

Just like others (NHibernate, WCF) the solution is quite simple: just copy the appropriate xsd file to C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\1033. In this case the MSBuild.Community.Tasks.xsd can be found in C:\Program Files\MSBuild\MSBuildCommunityTasks.

Need a GUID?

Seems like every piece of XML-code I recently write (mainly for WiX and MOSS these days) needs just about a dozen of GUIDs all over the place – well maybe just a bundle :=) … anyway!

OK, so guidgen.exe is a lot of help, but it’s also kind of a PITA to leave the keyboard, grab the mouse, do the clicking … in this time you could think of a new GUID yourself! So there must be a better way – and there is!

Just create a simple macro returning a new GUID – and you’re all set.

  1. start a new macro-project, maybe rename the default-module to something more appropriate
  2. use DTE.ActiveDocument.Selection.Text = System.Guid.NewGuid().ToString("D").ToUpper() to grab a new GUID
  3. assign the newly created macro a keyboard shortcut (tools\options\environment\keyboard) – ALG+G seems to be pretty intuitive
  4. ready to roll the GUIDs