Thursday, March 19, 2009

Internet Explorer 8

Internet Explorer 8 ships today. If you’re using a pre-release version or still using version 7, you can now get Internet Explorer 8 RTM from www.microsoft.com/ie8. If you want a preview of the new features to see if IE8 is right for you, just take a look at these videos.

Thursday, March 5, 2009

Windows Vista SP2 RC

Release candidates are now available for Windows Vista SP2 and Windows Server 2008 SP2. You can access the RCs from TechNet or MSDN if you have a subscription and wish to plan a deployment. Otherwise, the RTM versions will soon be generally available. You can read more here.

Wednesday, March 4, 2009

How to Remote Debug with Visual Studio 2008

It's pretty easy to setup Remote Debugging with Visual Studio 2008 but there are several steps involved. To begin with, this article makes the following assumptions:

  • You already have Visual Studio 2008 Pro or better installed on your Dev machine
  • Your Dev and Test machines are running Windows Vista, Windows Server 2008 or later
  • Your Dev and Test machines are on the same subnet
  • Your Dev and Test machines are on the same domain or trusted domains

Strictly speaking, remote debugging doesn't require your machines to be on the same domain or even subnet. However, bi-directional socket connectivity is required between the two machines. These alternate scenarios are not covered.

Development Machine Setup

The first step is to configure the Windows firewall on your development machine. Thankfully, Visual Studio has a wizard for this:

  • Run the following from the Start Menu
    Start > Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 Remote Debugger Configuration Wizard
  • Step through the wizard
  • Uncheck the option to Run the Remote Debugger as a service
  • Select Allow only computers on the subnet to connect to the remote debugger
  • Click Finish

The next step is to share the Remote Debugger binaries so you can access them from your Test machine:

  • Open Windows Explorer and browse to directory
    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
  • Open the properties dialog for the Remote Debugger directory
  • Use the sharing tab to give yourself Read access to the share

The final step is to share your project binaries and symbols so you can run them directly from the Test machine. In many cases, your binary and symbol files are located in the same directory so you don't need a separate symbol share.

  • Open Windows Explorer and browse to your project bin directory
  • Open the properties dialog for you bin directory
  • Use the sharing tab to give yourself Read (+Write) access to the share
    (Add Write access if your application needs to write to the directory)
  • (Optional) Repeat these steps for your symbols directory

Test Machine Setup

The first step is to logon to your Test machine using the same account that you use on your Dev machine. You can use a different account but you will need to grant access to the shares on your Dev machine.

Once you've logged on, you need to update your symbol path. This is only required if you created the symbol share on your development machine.

  • Open the properties page for your computer
    Start > Right Click Computer > Properties
  • Click advanced system settings
  • Click environment variables
  • Under user variables, click  New
  • Create the following variable:
    _NT_SYMBOL_PATH=%_NT_SYMBOL_PATH%;\\your-dev-pc\Symbols;

Next you need to configure the firewall to allow Visual Studio to connect inbound to the remote debugger monitor. The first time you run the remote debugger monitor and a connection is attempted, you will be given the option to automatically configure the firewall. However, if this doesn't happen, you can always run the following commands using an elevated console.

netsh advfirewall firewall add rule name="MSVSMON - UDP" dir=in action=allow enable=yes localport=any protocol=udp profile=domain remoteip=localsubnet program=”\\your-dev-pc\Remote Debugger\cpu-type\msvsmon.exe”

netsh advfirewall firewall add rule name="MSVSMON - TCP" dir=in action=allow enable=yes localport=any protocol=tcp profile=domain remoteip=localsubnet program=”\\your-dev-pc\Remote Debugger\cpu-type\msvsmon.exe”

The final step is to run the remote debugger monitor. When you run MSVSMON, you will see a message indicating that a new server called 'your-domain\your-username@your-test-pc' is waiting for new connections.

Remote Debugging

Now you are setup, all you have to do is run your application from the bin share on the Dev machine and use Visual Studio on your Dev machine to attach to the remote server.

Here's how to run your application on the Test machine and attach the debugger on your Dev machine:

  • Open Windows Explorer on your Test machine
  • Browse to and run the remote debugger monitor
    \\your-dev-pc\Remote Debugger\cpu-type\msvsmon.exe
  • Browse to and run your application
    \\your-dev-pc\bin\your-app.exe
  • Start Visual Studio 2008 on your Dev machine
  • Open your target solution file
  • Open the Debug menu and choose the Attach to Process menu item
  • Set the Transport to Default
  • Enter the Qualifier
    your-domain\your-username@your-test-pc
  • Click the refresh button
  • Select your remote process from the list
  • Click Attach

If everything is working, you should see the remote debugger loading symbols from the bin or symbol share on your Dev machine. However, you can also configure Visual Studio to automatically start your project on the remote machine. The following steps assume you have a .NET project.

  • Open the project properties page
  • Click the Debug tab
  • Under Start Action, select Start external program
  • Set the program path
    \\your-dev-pc\bin\your-app.exe
  • Add your command line arguments
  • Set the working directory
    \\your-dev-pc\bin\
  • Check Use remote machine
  • Set the remote machine
    your-test-pc
  • Save

Now when you press F5 to debug, the application will automatically run on your remote Test Machine and you don't have to attach.