Thursday, 25 February 2010

Changing default editor for batch scripts.

Right clicking on a .bat or .cmd file and select edit will open the file in the default program, Notepad. I prefer to use a different editor. To change the default for these files requires a registry change:
  1. Open the registry editor (regedit.exe)
  2. Browse to HKEY_CLASSES_ROOT\batfile\shell\edit\command
  3. Edit the default value and change to the executable you want to use to edit the batch files,
    e.g. "C:\Program Files\Programmer's Notepad\pn.exe" "%1"
  4. Click OK
  5. Browse to HKEY_CLASSES_ROOT\cmdfile\shell\edit\command
  6. Edit the default value and change to the executable you want to use to edit the command files.
  7. Click OK
No restart required.

Wednesday, 24 February 2010

IIS 7.0 not serving CSS files

After a rebuild of IIS 7, I couldn't get any CSS files to return. If I browsed to the path http://localhost/styles.css, I would a blank page (even when I view source). The problem was that during the reinstall of IIS I forgot to add the Static Content Component.

For Vista and Windows 7:
Control Panel -> Programs -> Turn Windows features on or off

Then navigate to: Internet Information Services -> World Wide Web Services -> Common HTTP Features
Enable the Static Content option

Friday, 19 February 2010

Cannot load macro project error

After moving 'My Documents' folder to a different drive, I started getting an error when loading the macro's explorer window. The error was:

Cannot load macro project '' for the following reason:

'C:\Users\\Documents\Visual Studio 2008\Projects\VSMacros80\Samples\Samples.vsmacros' is an invalid or inaccessible macro project file

The problem is when you move your documents folder, this updates the environment variable %USERPROFILE%, but the macro's path for Visual Studio are stored in the registry.

Searching the registry I found the following two keys which had a 'path' value, referencing the C:\.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\OtherProjects7\0
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\RecordingProject7


To solve, change the 'path' values in the above keys to your new location and restart Visual Studio.

Attach to multiple w3wp processes

This is an update to a previous post as I am now working on a project that can have up to 3 w3wp processes running.

I've changed the following lines:

Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, compName).Item("w3wp.exe")
proc2.Attach2(dbgeng)


with:
For Each proc2 As EnvDTE80.Process2 In dbg2.GetProcesses(trans, compName)
If proc2.Name.Contains("w3wp.exe") Then
proc2.Attach2(dbgeng)
End If
Next

Wednesday, 3 February 2010

Visual Studio and Spark

There is a great post about setting up file icons, Templates and syntax highlighting in Visual Studio for spark templates here:

3 Useful Visual Studio Tricks for Spark Templates