Here's another goodie from the Visual Studio 2008 SDK. In
ProjectNode.CopyPaste.cs in the namespace Microsoft.VisualStudio.Package you'll find the following code snippet:
StringBuilder selectionContent = null;
// If there is a selection package the data
if (selectedNodes.Count > 1)
{
foreach (HierarchyNode node in selectedNodes)
{
selectionContent = node.PrepareSelectedNodesForClipBoard();
if (selectionContent != null)
{
sb.Append(selectionContent);
}
}
}
else if (selectedNodes.Count == 1)
{
HierarchyNode selectedNode = selectedNodes[0];
selectionContent = selectedNode.PrepareSelectedNodesForClipBoard();
if (selectionContent != null)
{
sb.Append(selectionContent);
}
}
Why do we need this if - else if construct? Does the foreach for a list with zero or one element not work?
Showing posts with label extensibility. Show all posts
Showing posts with label extensibility. Show all posts
Tuesday, March 4, 2008
Visual Studio 2008 SDK Goodies #3
Labels:
extensibility,
MPF,
SDK,
Visual Studio 2008,
VSX
Thursday, January 3, 2008
How to identify menus and commands in Visual Studio 2008
From Visual Studio 2005 SP1 on, there's an undocumented registry switch to enable debug messages which show the guid and id of a selected menu or command. To enable this hidden switch, you'll have to add a dword registry entry under [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\General] which is called EnableVSIPLogging. It should have a value of 0x00000001 (hexadecimal 1).
After restarting Visual Studio 2008, you can now identify menus and commands by pressing STRG+SHIFT and clicking on the menu or command.
For instructions on enabling this for Visual Studio 2005, see this article.
After restarting Visual Studio 2008, you can now identify menus and commands by pressing STRG+SHIFT and clicking on the menu or command.
For instructions on enabling this for Visual Studio 2005, see this article.
Wednesday, January 2, 2008
VSCT file format in Visual Studio 2008 SDK
Hilton Giesenow has made a fantastic How to video about the new vsct-file format which Microsoft is using in Visual Studio 2008 SDK. In contrast to other how to videos, just showing how to use the VsPackage wizard, Hilton shows every step manually. So you'll get a fare good understanding on each part.
You can find the video here.
You can find the video here.
Wednesday, December 19, 2007
Creating custom project types with Visual Studio
Mike Hadlow gives a fairly good overview on how to build a custom project type for Visual Studio:
Code rant: Building a Visual Studio Custom Project Type
Please note, that at least in Visual Studio 2008 you'll have to create a project template to show your own project type under File -> New Project. You don't get any error if you don't do this, but your project type will not be shown.
Code rant: Building a Visual Studio Custom Project Type
Please note, that at least in Visual Studio 2008 you'll have to create a project template to show your own project type under File -> New Project. You don't get any error if you don't do this, but your project type will not be shown.
Labels:
extensibility,
Visual Studio,
Visual Studio 2008
Subscribe to:
Posts (Atom)