Tag, you are it... Another way to organize your files in Visual Studio
- Posted: Jul 11, 2011 at 6:00 AM
- 7,118 Views
- 1 Comment
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
If you're reading this blog, it's pretty likely you're a Visual Studio user. And like most dev's you like to organize your project files and folder is "just this way". But what if you wanted to provide a different organization? Or have multiple file layouts? Wouldn't it be cool if you could tag a file and view them via those tags? Even applying multiple tags so you can have multiple views of your Project? Like a "business' layout and a dev layout?
Don’t you just hate that you have to view the files in your solution the Visual Studio way? Now you can you start viewing your files in a much more useful way! Start tagging your files in very easy steps!
Right click in your solution explorer, set the tags for each file, and then start navigating by tags from the Tag Explorer! (go to view -> other windows -> tag explorer)
Visual Studio Tags (http://vstags.codeplex.com/)
Taking a look at the Project...
public void Tag()
{
IEnumerable<FileItem> selectedItems = envDte.SelectedItems
.OfType<SelectedItem>()
.Select(si => new FileItem {Name = si.Name});
IEnumerable<string> candidateTags = GetCandidateStrings(selectedItems);
IEnumerable<string> tags = selector.Select(candidateTags);
if (!selector.Selected) return;
foreach (SelectedItem rootProjectItem in envDte.SelectedItems.OfType<SelectedItem>())
{
IVsHierarchy hierarchy;
((IVsSolution) solution).GetProjectOfUniqueName(
rootProjectItem.ProjectItem.ContainingProject.UniqueName, out hierarchy);
var buildPropertyStorage = hierarchy as IVsBuildPropertyStorage;
if (buildPropertyStorage != null)
{
uint itemId;
var fullPath =
(string) rootProjectItem.ProjectItem.Properties.Item("FullPath").Value;
hierarchy.ParseCanonicalName(fullPath, out itemId);
string newTags = string.Join(" ", tags);
string currentTags;
buildPropertyStorage.GetItemAttribute(itemId, "Tags", out currentTags);
ApplyTags(currentTags, newTags, buildPropertyStorage, itemId);
}
}
} This project shows off a couple things. That you don't have to be satisfied with how Visual Studio organizes your files, how to hook into Visual Studio/Project and finally creating distributable Visual Studio Extension.
The page image, Tagged!, is curtsey of JD Hancock
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
I was just talking to another dev that we might have organized the project (folders and file names) wrong. It became clear we thought about the project differently and we needed to be able to represent all perspectives of the project. We couldn't think of a good fix but this is perfect. I can tag files with what they represent to me (different layers so I can jump to the layer I want fast) regardless of how visual studio has them organized.
Remove this comment
Remove this thread
close