Welcome to MSDN Blogs Sign in | Join | Help

Getting a list of TFS files that are different since some date

Have you ever come across a need to find out which TFS version control files that are different since some date or some changeset? In VS2008 + VSTF 2008 (Orcas), there is an easy way using Folder Difference. Let take a look at the following command.

tf folderdiff $/TP/myfolder;C1234 $/TP/myfolder /r /view:different /noprompt

 

This command compares all files under $/TP/myfolder at version C1234 to the latest version and then output the files that are different to the console window. You can remove the /noprompt to get a UI from which you can also copy/paste the file list to Excel.

Instead of a changeset specification Cnnnn, you can specify a date like Dyyyy/mm/dd.

In addition to /view:different, you can try /view:different,sourceonly,target to also list the files that only exist in the source or the target folders.

The Folder Difference is also available from Visual Studio's Source Control Explorer toolbar and context menu.

-Tan

 

Posted by PermanentTan | 1 Comments

How to set MyControl.X and MyControl.Y in a Windows Presentation Foundation (WPF) Canvas?

WPF elements (like Button and Rectangle) do not have the X and Y properties as in the WinForms controls. Using procedural code, to place a WPF element  at a specific XY on a free-form work area like a Canvas, you can use Canvas.SetLeft() and Canvas.SetTop(). Using XAML, you can use the attribute Canvas.Left and Canvas.Top.

Also try using Intellisense on Canvas.Set* to see other available properties that can be changed this way.

For advanced reading, see WPF Dependency Properties. http://msdn2.microsoft.com/en-us/library/ms752914.aspx

-Tan

Posted by PermanentTan | 1 Comments

Default work item query for the Pending Changes window

 

There has been a couple of requests about the logic for determining the default work item query in the Pending Changes window in Visual Studio. Here is how it works.

 

In the Pending Changes window, the work item query uses an MRU list. In general, once a query is run in the work item channel, the last-run query for a team project becomes the default query for that team project in the work item channel.

 

Algorithm for determining the query for the work item channel in VS

  1. If the work item channel already has a query MRU list (ie. work item channel already opened before):
    1. If the team project for the last query is still in TE, the query is used. If the team project is no longer in TE, the next query in the MRU list, whose team project is still in TE, is used.
    2. If no other query is available from MRU, go to step 2.ii
  1. If the work item channel does not have a query MRU list (ie. the very first time opening the work item channel):
    1. The TE active project is used to search for query My Work Items. If found, that is the initial default query. If not found, go to next step.
    2. Starting with the first team project in TE, search each project for query My Work Items. The first My Work Items query found is the initial default query. If one is not found, go to next step.
    3. The first query of the first team project is the initial default query

 

Delete the following cache file to clear the MRU history:

C:\Documents and Settings\<YourUserName>\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache\WorkItemHistory_<YourServerGUID>

C:\Documents and Settings\<YourUserName>\Local Settings\Application Data\Microsoft\Team Foundation\2.0\Cache\WorkItemHistory_<YourServerGUID>

Posted by PermanentTan | 1 Comments

Resuming Conflict Resolution in Team Foundation Version Control

I have gotten some feedback about the perception that the get/checkin/merge conflict resolution workflow for Team Foundation Version Control is a "one-shot" action in Visual Studio and cannot be abandoned and later resumed. Though it is true that the action to resume conflict resolution is somewhat hidden, it is available in two ways:

  1. From Visual Studio and with the Source Control Explorer opened, select File > Source Control > Resume Conflict Resolution
  2. From the command line: tf resolve /?

 Hope this helps. -Tan

Posted by PermanentTan | 1 Comments

Visual Studio Orcas March 2007 CTP - Folder Difference - Part 4

 

Visual Studio Orcas March 2007 CTP - Folder Difference - Part 4

 

In this installment, we'll wrap up the Orcas' Folder Difference preview witht the results view in Visual Studio.

 

Results View

 

The Folder Difference results view has been significantly changed since the Power Tool release. The view now integrates a VSIP toolbar, a status strip/progress bar, and the main output.

 

The first screenshot shows the comparison of a server folder to its mapped local folder.

 

 

The second screenshot shows the comparison of two server folders.

 

 

The third screenshot shows the comparison of two local folders.

 

 

Background Processing

 

The most significant change to the Folder Difference engine has been in the way the querying and traversing of folders and the comparison of files are now done on a background thread. Doing the work on a background thread, in turn, no longer blocks Visual Studio IDE like in the older Power Tool implementation.

 

Toolbar and Status Strip

 

The status strip doubles as a progress bar and a statistics display.

 

 

 

The toolbar adds a new Rerun Compare button which brings back the compare dialog that has the parameters that were used in the last compare. The Rerun Compare button and the Modify Filter link provide quick ways to tune your compare inputs.

 

 

 

Fonts and Colors

 

The result view fonts and colors can be customized using Visual Studio Tools > Options > Fonts and Colors and select Folder Difference in Show settings for combobox.

 

 

 

That's it on Orcas Folder Difference for now.

Enjoy. -Tan

 

 

Posted by PermanentTan | 0 Comments

Visual Studio Orcas March 2007 CTP - Folder Difference - Part 3

 

In this installment, we'll talk about Folder Difference integration in Visual Studio starting with the new Compare dialog.

 

New Compare Dialog

 

 

When invoked from the Source Control Explorer (SCE), the source and target folders are pre-filled. The source path is the selected path in SCE. The target path is the mapped local path, if available. Clicking the Browse buttons will bring up either the version control server folder browser or the local file system folder browser.

 

Also new in the compare dialog are the Filter combobox, the Filter local path only option, and the View options - quite similar to the "tf folderdiff" new command line options.

 

Filter Combobox

Semicolon delimited list of inclusion and exclusion filter masks. See "File and Folder Filter" below.

 

Filter Local Path Only Option

When checked, only the local paths will be filtered, unless the corresponding server path exists. If  unchecked, the filter is applied to both server and local paths.

 

View Options

These options tell Folder Difference what files to show in the result window.

Show items that exist only in source path

List only files that exist only in source directory will be included

Show items that exist only in target path

List only files that exist only in target directory will be included

Show items that are different

List only files with different content in both source and target directories will be included

Show items that are the same

List only files with the same content in both source and target directories will be included

 

The default is to list only the files that are different or missing.

 

File and Folder Filter

A filter is an ordered list of name masks that are used to match the name of files and folders to be compared.

 

Each mask can contain the wildcard characters ? and *. ? matches exactly one character and * matches zero or more characters. The masks in a filter are delimited by semicolons (;). Folder masks must end in backslash (\). To specify an exclusion mask, prefix the mask with an exclamation mark (!).

 

The filter is applied to the file and folder names using the following rules:

  • When both file and folder masks are specified together in a filter, the file masks are separated into a file mask list and the folder masks are separated into the folder mask list. File masks are only applied to file names. Folder masks are only applied to folder names.
  • When a file/folder name is being matched, the name is compared to each mask in the filter in the order that was specified. As soon as the name matches a mask, the name is considered to be a match.
  • If the file masks in the filter contains an inclusion mask, files that do not match any of the file masks are excluded.
  • If the file masks in the filter contains only exclusion masks, files that do not match any of the file masks are included.
  • If the folder masks in the filter contains an inclusion mask, folders that do not match any of the folder masks are excluded.
  • If the folder masks in the filter contains only exclusion masks, folders that do not match any of the folder masks are included.

 

Here are some examples:

*.cs;!objd\;!obj\;!bin\

Matches all C# files and excludes objd, obj, and bin directories

!*.resx;!*.ini;!resources\;!*junk*\

Excludes all resx and ini files as well as the resources folders and those having "junk" in the name

 

Next time, we'll talk about changes in the Folder Difference results window.

-Tan

Posted by PermanentTan | 0 Comments

Visual Studio Orcas March 2007 CTP - Folder Difference - Part 2

 

Let us start with the Folder Difference invocation. Both Power Toy TreeDiff and Orcas Folder Difference support command line invocation as well as from the Source Control Explorer in Visual Studio.

 

Starting from the Command Line

 

In the Orcas CTP, Folder Difference is integrated into tf.exe with command folderdiff or treediff (as a command alias).

 

>tf folderdiff /?

 

TF - Team Foundation Source Control Tool

(C) Copyright 2007 Microsoft Corporation. All rights reserved.

 

Displays a visual representation of the differences between files in two server

folders, in a server folder and a local folder, or in two local folders.

 

tf folderdiff [sourcePath] targetPath [/recursive] [/noprompt]

              [/server:serverName:port] [/filter:filter]

              [/filterLocalPathsOnly]

              [/view:view]

 

The new options are:

/filter:filter

/filterLocalPathsOnly

/view:view

 

Option /filter:filter

Semicolon delimited list of inclusion and exclusion filter masks. Default is “*” (include all). See "File and Folder Filter" below.

 

Option /filterLocalPathsOnly

If this parameter is specified, only the local paths will be filtered, unless the corresponding server path exists. If not specified, the filter is applied to both server and local paths.

 

Option /view:view

This option tells Folder Difference what files to show in the result window. The option is comma-separated list of the following values:

 

Same

files with the same content in both source and target directories will be included

Different

files with different content in both source and target directories will be included

SourceOnly

files that exist only in source directory will be included

TargetOnly

files that exist only in target directory will be included

 

The default is “/view:Different,SourceOnly,TargetOnly” which lists only the files that are different or missing.

 

File and Folder Filter

A filter is an ordered list of name masks that are used to match the name of files and folders to be compared.

 

Each mask can contain the wildcard characters ? and *. ? matches exactly one character and * matches zero or more characters. The masks in a filter are delimited by semicolons (;). Folder masks must end in backslash (\). To specify an exclusion mask, prefix the mask with an exclamation mark (!).

 

The filter is applied to the file and folder names using the following rules:

  • When both file and folder masks are specified together in a filter, the file masks are separated into a file mask list and the folder masks are separated into the folder mask list. File masks are only applied to file names. Folder masks are only applied to folder names.
  • When a file/folder name is being matched, the name is compared to each mask in the filter in the order that was specified. As soon as the name matches a mask, the name is considered to be a match.
  • If the file masks in the filter contains an inclusion mask, files that do not match any of the file masks are excluded.
  • If the file masks in the filter contains only exclusion masks, files that do not match any of the file masks are included.
  • If the folder masks in the filter contains an inclusion mask, folders that do not match any of the folder masks are excluded.
  • If the folder masks in the filter contains only exclusion masks, folders that do not match any of the folder masks are included.

 

Here are some examples:

*.cs;!objd\;!obj\;!bin\

Matches all C# files and excludes objd, obj, and bin directories

!*.resx;!*.ini;!resources\;!*junk*\

Excludes all resx and ini files as well as the resources folders and those having "junk" in the name

 

 

Starting from Visual Studio

 

Folder difference can be started from various location in Visual Studio.

  • From the Source Control Explorer context menu on the folder tree or file list
  • From the Source Control Explorer toolbar
  • From File > Source Control > Compare

 

Note that the Compare menu item is context sensitive. A file comparison dialog will be presented for file selection and a folder comparison dialog will be presented for folder selection.

 

 

 

 

 

That's it for this installment of Orcas CTP Folder Difference. Next time, we'll talk about changes in the Visual Studio integration which will include the new folder compare dialog and the results window.

-Tan

Posted by PermanentTan | 0 Comments

Visual Studio Orcas March 2007 CTP - Folder Difference - Part 1

Through out April 2007, I'll be posting details about the new feature Folder Difference currently in the Visual Studio Orcas March 2007 CTP release (download). In addition to the name change from TreeDiff to Folder Difference :), I'll stay focused on the differences between this Orcas Folder Diffference and the older Visual Studio 2005 PowerTools TreeDiff. In this post, however, we'll get started with a couple of screenshots of the new Visual Studio Folder Difference.

Here are some hightlights of the differences between the two versions:

  • Does not block Visual Studio IDE while doing a folder comparison
  • Full support for file/folder filters and view output options
  • Easily refine compare parameters including filters, both source and target folders, server versions
  • Refined UI for improved usability and for tighter integration with Visual Studio
  • Full options support for command line
  • Higher performance (2X to 38X)
  • Extensibility support
  • Robust error handling
  • Localized

Enjoy. -Tan

 

Folder Difference in Visual Studio Comparing a Mapped Server/Local Folder

 

Folder Difference in Visual Studio Comparing Two Server Folders

 

Folder Difference Engine Working

 

Folder Difference Status Strip

 

Enhanced Compare Dialog for Folder Difference

Posted by PermanentTan | 3 Comments

Preparing for Vista Backup and Restore - Part 2 of 2

Happy New Year! 

Last time we finished with using CompletePC to backup the OS partitions/drives as well as work files and left with the question: how do I restore just my data/work drive, just a folder, or even just a file? Today's blog discusses a solution that (I think) is quite satisfactory. Please read on...

Restoring the entire computer:

CompletePC backup/restore does allow restoration of all the backup boot partitions/drives and optionally the individual data partitions/drives. This is the default capability for CompletePC Backup and Restore. If this is what you want, everything you need is built-in.

Restoring a Folder or a File:

As discussed in the last post, CompletePC backup/restore does not allow finer-granularity restoration of a folder or file. Fortunately, there is a solution using a tool called VHDMount which comes with Virtual Server 2005 R2 SP1 Beta 2. (Don't forget the Beta 2 part!) There are many blogs that describes how VHDMount work and there is no need to rehash the discussion here. Here is a brief description of what VHDMount can do for Vista CompletePC backups:

  • For each partition/drive that is backed up, CompletePC creates a .vhd file in the backup destination
  • VHDMount is a command line tool which takes the .vhd file and "mounts" it as a drive (like M:\)
  • Once the .vhd file is mounted as a drive, you can use Window Explorer (or whatever tools) to copy/restore whichever folder(s) or file(s)

One thing that is a little clumpsy with this technique is that you cannot easily associate which .vhd file to which previously backed up partition/drive by just visual inspection of the file name. The .vhd file name has the format similar to <guid>.vhd - not readily translated to which drive that was backed up.

Here are some links to downloading, installing, and customization of VHDMount.

At this point, I've tried VHDMount to access backed up my partitions/drives and found it to work very well. I am now a happy camper with Vista backup and restore!

That's all I have for Vista Backup and Restore. Have fun!

-Tan

Posted by PermanentTan | 5 Comments

Preparing for Vista Backup and Restore - Part 1 of 2

Happy Holidays Everyone!

What could be better than spending the Holidays backing up your computers? :) If you have Windows Vista (Ultimate Edition) and if you are thinking about using Vista's new Backup and Restore Center, here are a few things that you may want to consider before starting.

Vista has two backup/restore modes: the normal backup and the CompletePC backup. Both are very easy to use but the ease-of-use has trade-offs and limitations. I leave you to do independent reading on the details of these two backup mechanisms. This blog focuses on the limitations and ways to "make the best" of Vista backup.

The Normal Backup

This mechanism backs up an entire Windows drive and offers scheduling and incremental backup like any other backup program. For ease-of-use, Vista offers drive-level source and category-based file filtering. Drive-level means that you can only specify the drive (like C: and D:) but not the individual folders (like D:\MyPrograms\MyDir). Category-based file filtering means that Vista decides which files to backup and which files to exclude.

By now you may be asking, “You mean I can’t pick which folders to include or exclude from the backup?” Yes!

Not being able to select individual folders to backup is a major handicap but not a show stopper. Developers often have one or more source code enlistments on their drives along with other daily work data. The daily work data has to be backed up but the source code enlistments most often do not since they are normally from a version control system (like the Team Foundation System). With Vista backup, if you have to back up your daily work data, you have to back up the entire drive and needlessly include those source code enlistments. My way around this limitation is to separate my daily work data and the source code enlistments into different drives.

But before you jump for joy, there is this little technicality called category-based file filtering…

Category-based file filtering means that Vista decides on which files to back up and which files to exclude based on its internal determination of the file’s category. The downside of this is that you cannot be sure that ALL of your files are backed up. This limitation is critical, if you, like me, keep personal tools (.exe) and scripts (.bat, .cmd) that also need to be backed up. These files (and others that falls into the “exclude category”) will be skipped and you'll end up with unknowingly incomplete backups.

The question now is: How likely are you going to back up files that are in the Vista backup engine's "exclude category"? As a developer, I would say "Very likely!" As a home user like millions of others, I would say "Not so likely!" This leads to my recommendation: Fellow developers out there should really think twice about using the Vista normal backup to back up your daily data and work environment because your backups may be incomplete.

The CompletePC Backup

This mechanism backs up an entire PC which includes the Vista system drive and, optionally, any other Windows drive in the computer.  If you dual boot, both the boot partition/drive and the Vista partition/drive will be included in the backup. You can optionally include additional Windows drive.

Unlike the “normal backup”, a CompletePC backup includes ALL files and folders! Yeah!

The backup process is very quick using block-level copy. There is also no data compression. If the drives to be backed up total to 90GB, the backup will be around 90GB. Make sure that you have enough space in your backup storage.

To restore from a CompletePC backup, you’ll have to boot into System Recovery Mode using your Vista install disc (or F8 from the Advance Boot Options menu). The restore process will restore the Vista system drive plus any other system drive that is needed to boot. For example, if you backed up a dual boot PC and the backup contains drive C: (XP) and drive D: (Vista), both drives C: and D: will be restored. Restoring other non-system drives is optional. Special care must be taken since drive restoration is destructive and all current data on the drives to be restored will be lost.

This is actually my current setup. I separate my data/work and source code enlistments into different drives and use CompletePC Backup to back up my system drives (XP) C: and (Vista) H: along with my work drive D:. Now I can back up and restore my system drives and optionally my work/data drive.

The question now is: Now that I have everything backed up the way I wanted, how do I restore just my data/work drive, just a folder, or even just a file?

Stay tuned. I’ll have an answer (or way or the other) for you in the next blog. See part 2.

Merry Christmas and Happy New Year!

-Tan

 

PS. Here is an interesting reading from Dan Stevenson of Microsoft about Vista backup and restore. http://download.microsoft.com/download/5/b/9/5b97017b-e28a-4bae-ba48-174cf47d23cd/BUS107_WH06.ppt

 

Posted by PermanentTan | 2 Comments

Customizing the Team Foundation Tree Difference (TreeDiff) Power Toy

Welcome back!

Before we get started on Tree Difference customization, I would like to bring forth some known bugs and their work-arounds. The bugs and their work-arounds are discussed in these blog postings:

With the bugs out of the way, let's talk about customizing the Tree Difference.

Tree Difference uses a couple of registry keys. Except for the View Options, all other settings are only available via direct access to the registry.

  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\PowerToys\TreeDifference\NonRelevantMasks. You can use values in this key to filter out selected files and folders from the results. These masks are applied to both the server and local paths.
    • FileExtensions: This is a list of semicolon-delimited file extension masks. Any file with an extension matching one of these extensions are excluded from the results. Due to a bug (discussed above), do not include the '*' wildcard in the masks. There is no support for wildcard file name matching or file inclusion masking in the Tree Difference power toy release. Default value is: *.pdb;*.obj;*.dll;*.exe;*.res;*.resources;*.cache;*.ilk
    • FolderExtensions: This is a list semicolon-delimited folder name masks. Any folder with name matching one of these names are excluded from the results. Do not include '*' wildcard in the masks. Similar to the file extension exclusions, there is no support for wildcard folder name matching or folder inclusion masking in the power toy release. Default value is: obj;objd. You may want to also add "bin".
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\PowerToys\TreeDifference\ViewOptions. You can use these values to further control which items to be shown in the results. In addition to directly accessing these registry values, these four options are also available in the context menu in the tree difference results list.
    • ShowSourceOnlyItems: Set to True to show items that only exist in the tree on the left. Default is True.
    • ShowTargetOnlyItems: Set to True to show items that only exist in the tree on the right. Default is True.
    • ShowDifferentItems: Set to True to show items that are on both sides but having different contents. Default is True.
    • ShowEqualItems: Set to True to show items that are on both sides and having identical contents. Default is False.
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\PowerToys\TreeDifference\Colors. These colors are specified in ARGB32 dot notation: A.R.G.B where A is the alpha value (0-255), R is the red value (0-255), G is the green value (0-255), and B is the blue value (0-255).
    • SourceOnlyItems: Text color for items that only exist on the left side. Default is blue.
    • TargetOnlyItems: Text color for items that only exist on the right side. Default is dark green.
    • DifferentItems: Text color for items that have different contents. Default is red.
    • EqualItems: Text color for items that have identical contents. Default is black.
    • NonDownloadedItems: Text color for local files that are mapped to a server location but whose content has not been downloaded. This color is only applied to the local file name. Default is medium gray.
    • ColoringForEvenRows: Background color for the even-numbered rows. The different even/odd row background colors can help visually distinguish adjacent rows. Default is very light gray.
    • ColorForOddRows: Background color for the odd-numbered rows. Default is white.

There is one more setting that is available from Visual Studio Tools > Options > Team Foundation Server Power Toys > General. In this page, there are actually two settings: one for Annotate and the other for Tree Difference. Setting the Tree Difference value to False disables the Tree Difference feature in Visual Studio. Once disabled, the tree difference context menu item in Source Control Explorer will no longer be visible.

This wraps up Tree Difference customization. Stay tuned!

-Tan

Posted by PermanentTan | 6 Comments

Centering a MessageBox

Message boxes are centered on the desktop. Occasionally I get a request for C# code for centering a message box to its owner. Before pointing you to some sample code, I would strongly encourage you to reconsider changing the default behavior of the system message box in your application because, by design, the message box is supposed to be a "please read me now" kind of thing. Additionally, the technique uses the SetWindowsHookEx function which has an application-wide impact and is thread-sensitive.

OK! If you still want to center the system message box to its owner, you can check out the sample code and read the technique at http://www.codeproject.com/cs/miscctrl/CenterDialog.asp.

Enjoy. -Tan

Posted by PermanentTan | 0 Comments

AutoLayout Basics for TableLayoutPanel

Jason Prickett has put together a step-by-step how-to for using the TableLayoutPanel container. The detailed steps are very nice for those who are new to the Visual Studio 2005 Designer and TableLayoutPanel control for auto-layout. Check it out!

 

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included

script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

 

 

Posted by PermanentTan | 0 Comments

AutoLayout by Examples - Part 4 - Shrink

Shrink: Mockup of a popular DVD Compression Program

 

Project Name: Shrink.csproj. Download source.

 

Characteristics:

  • Multiple-level nested TableLayoutPanel
  • Nested SplitterPanels
  • Menu and toolbar

 

Screen Shots:

 

 

Dialog Designer Layout:

 

 

Dialog Document Outline:

 

 

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included

script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

 

 

 

Posted by PermanentTan | 1 Comments

AutoLayout by Examples - Part 4 - XP Calculator

XP Calculator: Mockup of the XP Calculator

 

Project Name: Calculator.csproj. Download source.

 

Characteristics:

  • Many rows and columns in a single TableLayoutPanel

 

Screen Shots:

 

 

Dialog Designer Layout:

 

 

Dialog Document Outline:

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included

script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

 

 

Posted by PermanentTan | 1 Comments
 
Page view tracker