See that line of code up there? I need it here as well.

It happens all the time, you’re writing a new code segment and see the line you’re about to write (or close enough version of it) a few lines above your cursor.

If you’re anything like me – you have your line numbers always displayed so you can tell which line it is that you’re after; you hit Ctrl·G, type in the line number, select the text once you get there and go back to the line you were editing using Ctrl·-, Ctrl·G or the arrow keys, depending on your mood; now you just need to paste the code back. A lot of time wasted here.

If you’re not so much like me – you’ll use the mouse and spend a little less time (in this specific case).

So, why spend time at all? Let’s automate baby!

Take this macro and paste it in your Macro explorer in VS2003 (might also work in VS2005 but I haven’t tested it just yet):

CopyLine macro for Visual Studio 2003 (and later?)
Sub CopyLine()
source = DTE.ActiveDocument.Selection.TopPoint.Line
line = InputBox("Line number to copy here:")
If (line <> "") Then
DTE.ActiveDocument.Selection.GotoLine(line)
DTE.ActiveDocument.Selection.EndOfLine(True)
DTE.ActiveDocument.Selection.Copy()
DTE.ActiveDocument.Selection.GotoLine(source)
DTE.ActiveDocument.Selection.Paste()
End If
End Sub

I assigned Ctrl·Alt·Shift·C to this macro so my line copying is just 2-4 clicks away (if your line numbers reach 4 digits or more, you have more serious problems…)

You can copy this to another macro and replace the Copy( ) command with Cut( ) so you’ll also have a line moving macro. :-)

Published in: on August 22, 2007 at 2:33 Leave a Comment

It’s not the same GAC anymore.

So, you think you know where the GAC is…

The problem (a.k.a. “why do I need to know?”)

Windows doesn’t let you access the GAC assemblies directly from Explorer. You just get the basic GAC metadata and can only add/remove entries but not manipulate them. You can’t even see file size!

The solution for .NET 1.1 (a.k.a. “oh, I already know that”)

You probably know you can access these assemblies using the console window by diving into the C:\WINDOWS\assembly\GAC\<assembly-name.dll> folder.

What changed in .NET 2.0 (a.k.a. “more places to hide in”)

The .NET 2.0 GAC is split between several folders.

Mostly you’ll find what you’re looking for in the C:\WINDOWS\assembly\GAC_MSIL\<assembly-name.dll> folder.

The previous “GAC” folder still exists and contains only .NET 1.1 assemblies.

There are a couple of other “GAC” prefixed folders which contain 32 and 64 bit specific assemblies. In these folders you’ll find assemblies which use some native code.

In short

.NET Version

GAC Location

1.1

C:\WINDOWS\assembly\GAC\

2.0

C:\WINDOWS\assembly\GAC_MSIL\ and C:\WINDOWS\assembly\GAC_32\ and

C:\WINDOWS\assembly\GAC_64\

Published in: on August 21, 2007 at 17:24 Leave a Comment

The #1 programmer excuse…

This is soooo true!

#1 excuse...

Published in: on August 20, 2007 at 13:46 Leave a Comment