A personal repository of technical notes. - CSC

Team Foundation Server Compare Ignore Whitespace

Problem

Need to get TFS Compare to ignore whitespace

Solution

Select menu item Tools/Options/Visual Studio Team Foundation Server.
Click button Configure User Tools...
Click Add
Extension = .*
Operation = Compare
Command = C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe
Arguments = %1 %2 %6 %7 %5 /ignorespace

See command line help with:
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe" /?

References

"JB Brown: Whitespace in Team System Compare Results - TeamReview, Visual Studio Team System, and Lean." JB Brown - TeamReview, Visual Studio Team System, and Lean. Web. 21 June 2011.
<http://www.controlstatements.com/2009/03/whitesapce-in-team-system-compare.html>.

"Difference Command." MSDN Explore Desktop, Web, Cloud, and Phone Software Development. Web. 21 June 2011.
<http://msdn.microsoft.com/en-us/library/6fd7dc73(VS.80).aspx>.

How to Install Microsoft Free Virus Software

  1. Download Microsoft Security Essentials installation file to your desktop
    Virus, Spyware & Malware Protection | Microsoft Security Essentials
    http://www.microsoft.com/en-us/security_essentials/default.aspx
  2. Disconnect from the internet because you will be unprotected for a few minutes. Unplug from the cable modem, etc.
  3. Uninstall virus/security software that is currently on your computer.
    If you need help figuring out how to uninstall, connect back up to the internet, go to this page and print it off, then disonnect again:
    How do I uninstall antivirus or antispyware programs?
    http://www.microsoft.com/en-us/security_essentials/Support/4cae1455-6ead-493c-b5d8-7c88f39c0656.aspx
  4. Install Microsoft Security Essentials from your desktop installation file.
  5. Make sure Windows firewall is turned on in case the old security software included a firewall.
    Understanding Windows Firewall settings
    http://windows.microsoft.com/en-US/windows7/Understanding-Windows-Firewall-settings
  6. Reconnect to the internet and allow Microsoft Security Essentials to update itself.

SQL Concatenate Row Data into Variable

Problem

Need to generate a comma-delimited string list from data contained in rows of table

Solution

DECLARE @commaDelimitedList varchar(8000)
SET @commaDelimitedList = '' -- Must set to empty value

SELECT @commaDelimitedList = @commaDelimitedList + [MyColumn] + ','
FROM [MyTable]

-- Remove trailing comma from list
IF (@commaDelimitedList <> '')
BEGIN
      SET @commaDelimitedList = LEFT(@commaDelimitedList, LEN(@commaDelimitedList) - 1)
END

-- Return record set
SELECT @commaDelimitedList AS 'CommaDelimitedList'

Debug Console Application When Started Outside of Visual Studio

Problem

Need to be able to debug a console application when the executable is started outside of Visual Studio. When doing this with a web application, you attach to process aspnet_wp.exe. This will not work with a console application.

Solution

Manually start debugger inside console application. Temporarily add the following line to the console application code:

System.Diagnostics.Debugger.Launch();

Running the console application executable will cause a prompt from Visual Studio Just-In-Time Debugger. At that time you may select Visual Studio from list of Possible Debuggers.

Option Strict On disallows late binding

Problem

When setting Option Strict On in Visual Studio macro, the following code examples:

Dim toolbar As Microsoft.VisualStudio.CommandBars.CommandBar
toolbar = DTE.CommandBars.Item("MyToolbarName")
DTE.ActiveDocument.Selection.NewLine()


Causes the error:

Option Strict On disallows late binding.

Solution

Use CType Function to explicitly convert an expression to a specified object like the following examples:

toolbar = CType(DTE.Commands.Item("MyToolbarName"), Microsoft.VisualStudio.CommandBars.CommandBar)
Dim activeDocument As Document = CType(DTE.ActiveDocument, Document)
Dim activeSelection As TextSelection = CType(DTE.ActiveDocument.Selection, TextSelection)

Windows XP Hangs Viewing Shortcuts

Problem
Windows hangs when opening or trying to view properties of shortcuts to network files that do not exist.

Note: This solution has been tested and works with Windows XP and Windows 7.

Solution
Prevent Windows from conducting a comprehensive search of the target drive in an attempt to find the file.
  1. Run gpedit.msc
  2. Select User Configuration / Administrative Templates / Start Menu and Taskbar
  3. Enable "Do not use the search-based method when resolving shell shortcuts"
References
"Windows XP Hangs When You Open a Folder That Contains a Network Shortc." PC Pitstop Forums. Web. 04 Mar. 2011.
<http://forums.pcpitstop.com/index.php?/topic/121312-windows-xp-hangs-when-you-open-a-folder-that-contains-a-network-shortc/>.
"Policy Settings for the Start Menu in Windows XP." Microsoft Support. Web. 04 Mar. 2011.
<http://support.microsoft.com/kb/292504>.
"Do Not Use the Search-based Method When Resolving Shell Shortcuts." Microsoft TechNet: Resources for IT Professionals. Web. 04 Mar. 2011.
<http://technet.microsoft.com/en-us/library/cc939469.aspx>.

Updates
2011-10-20 Added note that this works with XP and Win7.

KB2418241 MS10-070 Breaks Forms Authentication Ticket Sharing Between v1.1 and v2.0

Problem
Shared forms authentication between ASP.NET 1.1 and 2.0 stopped working after installing Security Update for Microsoft .NET Framework 2.0 SP2 and 3.5 SP1 on Windows Server 2003 and Windows XP x86 (KB2418241).

Received the following error in Application Event Viewer after authenticating in a v1.1 web page and then browsing to a v2.0 web page:
Event code: 4005
Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid.

Solution
As of 11/1/2010: Apply Hotfix KB2433751.

"KB2433751 - Form Authentication Ticket Compatibility Issue with MS10-070 - Home." MSDN Code Gallery - Home. Web. 01 Nov. 2010.
<http://code.msdn.microsoft.com/KB2433751>.

Note: Download NDP1.1sp1-KB2433751-X86.exe worked with Windows XP.

References
"MS10-070: Description of the Security Update for the Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 2.0 Service Pack 2 on Windows Server 2003 and on Windows XP." Microsoft Support. Web. 01 Nov. 2010.
<http://support.microsoft.com/kb/2418241>.

"FIX: Forms Authentication Cookies Compatibility Issue between .NET Framework 1.1 and .NET Framework 2.0 SP2 ASP.NET Applications after You Apply the Security Update from Security Bulletin MS10-070." Microsoft Support. Web. 01 Nov. 2010.
<http://support.microsoft.com/kb/2433751>.

"KB2433751 - Form Authentication Ticket Compatibility Issue with MS10-070 - Home." MSDN Code Gallery - Home. Web. 01 Nov. 2010.
<http://code.msdn.microsoft.com/KB2433751>.

"Legacy Encryption Mode and Microsoft .NET Framework 1.1 - ASP.NET Forums." Forums.asp.net : The Official Microsoft ASP.NET Forums. Web. 01 Nov. 2010.
<http://forums.asp.net/t/1609592.aspx>.

VS2005 Remove Add Reference Recent MRU

Problem
Need to remove obsolete items from most recently used (MRU) recent references in Visual Studio.

Solution
The entries are located at these registry locations:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ComponentPickerPages\Recent\{2483F435-673D-4FA3-8ADD-B51442F65349}
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ComponentPickerPages\Recent\{9A341D95-5A64-11D3-BFF9-00C04F990235}

References
None

Keyboard Has Stuck Key

Problem
Keyboard has a stuck key but it can not be detected manually. Need a stuck key detector utility.

Solution
Use a utility such as Microsoft Keyboard Diagnostics (MS Key). MSKEY.EXE is a utility program that is included with the Microsoft IntelliType software. It allows you to test key response on the keyboard.

References
"Troubleshoot Wired Keyboards That Don't Respond or That Type Wrong Characters." Microsoft Support. Web. 16 Aug. 2010.
<http://support.microsoft.com/kb/258826>.
"Software Download." Microsoft Corporation. Web. 16 Aug. 2010.
<http://www.microsoft.com/hardware/download/download.aspx?category=MK>.

Open TFS Output Window in Visual Studio

Problem
Can't see TFS output window in Visual Studio.

Solution
Run macro to open window.
  

Public Sub OpenTFSOutputWindowPane()

Dim window As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)

Dim outputWindow As OutputWindow = CType(window.Object, OutputWindow)

Dim tfsOutputWindowPane As OutputWindowPane = outputWindow.OutputWindowPanes.Item("Source Control - Team Foundation")

tfsOutputWindowPane.Activate()

window.Visible = True

End Sub