4

SharpGL 2.1

For those who are interested, I’m now starting development of SharpGL 2.1. SharpGL 2.1 will primarily be a release to implement features and fix bugs that users have added to the Codeplex site. The actual features and bugs that’ll be sorted are on the CodePlex site – just search for release ‘SharpGL 2.1′.

This will also be the first release of SharpGL that will be published on Nuget.

2

Visual Studio Extensions and Menu Subitems

Recently I was working on a Visual Studio Extension for VS2010, instead of a single item in the the tools menu, what I wanted was a single item with a set of child items.

Strangely enough, documentation on this is quite lacking. So if you need to know how to do it, here’s the gist. First, create a standard Visual Studio 2010 extension with the wizard, we’ll have some code like the below to start off with, in the OnConnection function:

object []contextGUIDS = new object[] { };
Commands2 commands = (Commands2)_applicationObject.Commands;
string toolsMenuName = "Tools";

//Place the command on the tools menu.
//Find the MenuBar command bar, which is the top-level command bar holding all the main menu items:
Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)["MenuBar"];

//Find the Tools command bar on the MenuBar command bar:
CommandBarControl toolsControl = menuBarCommandBar.Controls[toolsMenuName];
CommandBarPopup toolsPopup = (CommandBarPopup)toolsControl;

//This try/catch block can be duplicated if you wish to add multiple commands to be handled by your Add-in,
//  just make sure you also update the QueryStatus/Exec method to include the new command names.
try
{
	//Add a command to the Commands collection:
    Command command = commands.AddNamedCommand2(_addInInstance, "MyCommand", "MyCommand",
        "Executes the command for MyCommand", true, 59, ref contextGUIDS,
        (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled,
        (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

   	//Add a control for the command to the tools menu:
	if((command != null) && (toolsPopup != null))
	{
		command.AddControl(toolsPopup.CommandBar, 1);
	}
}
catch(System.ArgumentException)
{
	//If we are here, then the exception is probably because a command with that name
	//  already exists. If so there is no need to recreate the command and we can
    //  safely ignore the exception.
}

Now what we’re going to do first, is change the code so that we don’t actually add a Command named MyCommand, but instead a popup:

//This try/catch block can be duplicated if you wish to add multiple commands to be handled by your Add-in,
//  just make sure you also update the QueryStatus/Exec method to include the new command names.
try
{
	//  Have we got the tools popup?
	if(toolsPopup != null)
	{
        //  Create 'MyCommand' as a popup.
        var popup = (CommandBarPopup)toolsPopup.Controls.Add(MsoControlType.msoControlPopup);
        popup.Caption = "MyCommand";
	}
}
catch(System.ArgumentException)
{
	//If we are here, then the exception is probably because a command with that name<br />
	//  already exists. If so there is no need to recreate the command and we can<br />
    //  safely ignore the exception.
}

Now that we have the popup object, we can create commands and add them to the popup instead:

//  Have we got the tools popup?
if(toolsPopup != null)
{
    //  Create 'MyCommand' as a popup.
    var popup = (CommandBarPopup)toolsPopup.Controls.Add(MsoControlType.msoControlPopup);
    popup.Caption = "MyCommand";
    //  Create sub item 1.
    var subItem1Command = commands.AddNamedCommand2(_addInInstance, "MyCommand1", "My Command Subitem 1", "My Command Subitem 1",
                                                       true, 59, ref contextGUIDS);
    //  Add it.
    subItem1Command.AddControl(popup.CommandBar, 1);
    //  Create sub item 2.
    var subItem2Command = commands.AddNamedCommand2(_addInInstance, "MyCommand2", "My Command Subitem 2", "My Command Subitem 2",
                                                       true, 59, ref contextGUIDS);
    //  Add it.
    subItem2Command.AddControl(popup.CommandBar, 2);
}

Now that we have made these changes, if we run the addin, we get a menu structure like this:

0

XPath Studio – First Cut

I have just uploaded the first cut of my mini-project ‘XPath Studio’. This project is a small site that lets you choose a URL to a source webpage, and run any XPath query against it – showing the data that is returned from the query.

At the moment this blog has an issue with images so I cannot upload screenshots, but in the next few days they’ll be there. Until then, you can try out XPath Studio by visiting:

www.xpathstudio.com

The project is ASP .NET MVC 4, with Razor. I’ve stripped out the bulk of the styling that’s provided by default, and layed it out with Twitter Bootstrap.

This is the first time that I’ve used Bootstrap and already have decided that it’ll be my first choice for web applications, at least those in the proof of concept phase. The library is lightweight, easy to use, clean and simple.

More updates on XPath Studio will come over the next few days, as I tweak the core functionality based on feedback.

8

Deployment Projects in Visual Studio 2012

[Note: They aren't bringing setup projects back, see http://www.dwmkerr.com/2013/06/visual-studio-deployment-projects-an-update/]

As part of Microsoft’s ongoing campaign to reduce the usability of their tools for anyone who isn’t working in exactly the way they want, Visual Studio 2012 no longer comes with the ability to create setup and deployment projects.

This is a pretty serious change. For anyone who is developing client applications, then an installer is pretty critical. Now the feature set in the VS deployment projects was fairly small – they were aimed towards making pretty basic, lean installers. And that was fine. That was what we needed it for. Installers for utility apps, installers for basic client applications, installers for testing out projects on other machines before we went to more advanced systems.

What’s truly disappointing is the lack of alternatives. Rather suspiciously there are links to InstallShield projects in Visual Studio now.

If you’ve never worked with InstallShield before then I envy you. It is truly awful – a maintainance nightmare combined with a user interface that makes creating basic installers baffling.

So Visual Studio now has no deployment projects. You can try using the free edition of InstallShield, but be ready for a world of pain. Also, considering the vast complexity of the UI, the free edition is incredibly limited in functionality – for example you cannot create ‘features’ (i.e. the chunks of functionality that you offer as an optional feature for an installation).

Example of Time Wasted

My Switch addin for Visual Studio adds a button to the UI that lets you switch between related files (cpp/h, aspx/aspx.cs etc etc).

I need to update it to work in Visual Studio 2012. I cannot develop VS 2012 addin projects in Visual Studio 2010. With a sigh I move the solution into 2012. I write the 2012 addin. The deployment project doesn’t load (as expected). I build the binaries into specific locations. I open the project in 2010. The 2012 addin doesn’t load (as expected). However, the setup project will not build due to an error when ‘updating dependencies’. This project has no dependencies – it builds from specific locations.

So now to release a version of Switch that supports VS2012, I need to use InstallShield. InstallShield’s free edition doesn’t support features – therefore I have to install Switch for 2008, 2010 and 2012 for everyone, always, regardless of whether they have it. A two hour update is not looking possible now. I don’t have the time to waste trying to bring back functionality I already had and have to move onto other work.

Conclusion

Thanks MS for removing this critical feature, and replacing it with an essentially useless and overly complicated alternative.

Please remember, we’ve paid for Visual Studio – not for a vessel to host adverts to other products. We had the functionality before, now its gone – replaced by links to an expensive (and frankly crap) suite of tools that aren’t suitable. Why has this happened? The cynical part of me thinks there’s some kind of deal going on between MS and InstallShield (well of course there is), and we’re suffering from it.

Hit the uservoice page here: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3041773-bring-back-the-basic-setup-and-deployment-project- to try and vote for it to go back in.