Friday 23 September 2011

Windows 8: How to setup Remote Debugging on Windows 8 using Visual Studio Express

Windows 8 is great and I have been having a lot of fun learning it and getting ready to develop Metro Applications. One of the first things I do when learning a new systems is to get to know my tools and how to configure them. One of the first things I wanted to know was "How do I setup Remote Debugging on Windows 8 using Visual Studio 2011 Express?"

NOTE:
  • The below steps are based on a Windows 8 Developer Preview with Tools machine to a Windows 8 Developer Preview with Tools machine. Luckily this seems to just work. I have included a few links on the bottom of this post to help you if you have problems.
  • Remote Debugging is installed on the Windows 8 Developer Preview Install so all you have to do is turn it on. The steps below will help you to do this.
On the Remote Machine that I want to run my debug applications on remotely I log in and start to configure remote debugging. I am configuring it so that my development machine can send remote debugging request to it. This includes Metro applications where your program is packaged up and remotely installed on this machine to run and be debugged by the development machine. Below are the required steps:
  • From the Start menu you need to click on the "Remote Debugger" panel show below surrounded in red.
  • For those of you that just need to know where the program is you can see the full path to it in the below screen shot.
  • After clicking on the "Remote Debugger" Panel you will be taken to the Windows desktop where the Visual Studio Remote Debugger is running.

On the development machine where I will be writing code and hitting F5 to run my code on the remote machine I will also need to do some configuration. Below are the required steps:
  • Load Visual Studio and the Solution that you be remote debugging.
  • Click the little down arrow next to the usual green start your project arrow as shown below
  • Select Remote Machine as Shown
  • Next you will need to update the Projects Debugging properties as shown below
  • Update the Machine Name to match the name of the machine that you configured for Remote Debugging in the earlier steps. I have put a red box around the exact place that will need to be updated.
You are now ready to start remote debugging!

Below are a few opportunities I encountered because I setup remote debugging on a fresh machine where I had not yet accepted the Metro licensing agreement.

After hitting F5 or clicking on the green start arrow from the Development Machine I was quickly prompted with the below dialog.


The dialog told me to check the console of the Remote machine that I am trying to run my program on. I quickly went to what I am calling the Remote Machine and noticed this prompt.


From the Remote Machine console I clicked on the "I Agree" button, then went back to the Development Machine and Clicked "OK" on the "Developer License Acquisition" dialog.

Visual Studio then continued to load and I was greeted with the program running on the Remote Machine as shown in the below screen shot


When I was done debugging on the Development Machine I ended the remote debug session by clicking on the Stop debugging button or by hitting "Shift+F5".

On the Remote Machine Console I can see that the program has stopped running there and all I have left is my Remote Debugging Monitor as show below


You can safely close this dialog by clicking on the red "x" above as usual. After doing this you will get a nice task tray notification letting you know that the Remote Debugger in still running as show below

Some Warnings:
  • Be sure to have the Remote Machine logged in and showing either the Start Panel or the Windows Desktop. You will get an error if you are not logged in.
  • As I eluded to earlier, the Metro program you are debugging is actually installed on the Remote Machine. You can see this in the screen shot below. I have placed a red box around the newly installed program to identify it for you


Below are a few links to sites that are related to this topic:

How to enable Remote Desktop on Windows 8 Developer Preview

I have Windows 8 up and running in a Virtual Machine and now I want to Remote Desktop to it. Luckily I found a great Blog article that explains this:
Knowing how links can dissapear I will repost the steps here:

  • Get to a command prompt, either by typing "cmd" in the search box or by clicking on the "Developer Command Prompt" panel in the Windows 8 Start screen. I have put a red box around this panel to highlight it below:
  • Once you are at a "cmd" prompt ( command prompt ) type in the word "SystemPropertiesRemote.exe" which will load the System Properties screen as shown below:
  • Select the appropriate Remote Desktop setting for you.
    • I usually just select the middle selection. "Allow Connections from any version of Remote Desktop (less secure)" on my development machines.
    • To be a good citizen I have shown the last selection "Allow connection only from computers running Remote Desktop with Network Level Authentication (more secure)" selected.
  • The last step is to click on the "Ok" button
To test if your configuration changes helped you will need to load up your Remote Desktop client on another machine and see if you can connect to your newly configured Windows 8 machine. Don't remember the name of the machine you just configured? Check out another post I have on the topic of finding the machine name in Windows 8:

Windows 8: How to get the name of the machine

Windows 8 Develop Preview is very cool! Recently when I was trying to Remote Desktop to my new machine I realized that my usual way of finding the computer name (right clickng on the "Computer" icon and selecting properties ) was not going to work.

How to get the computer name on Windows 8:
  • Get to a "CMD" / "Command Prompt" and type in "ipconfig /all" which will give you the below details:

On the first line of the output is the computer name which I have placed a red box around. Another reason why I like to use "ipconfig /all" is that if you are having DNS issues on your network you also have the IP Address of the computer to use to connect with.

One of the reasons Windows is so popular is that you can get to almost anything in Windows 100 different ways. Please share other ideas to get the computer name so we can all learn.

Hyper-V and Windows 8: Installing Windows 8 on Hyper-V

Windows 8 is a new beginning for Microsoft Flagship OS. You should experience it first hand yourself. You can download it from this location:
Once you have downloaded the appropriate ISO to your environment you can then follow the below steps to install Windows 8 on Microsoft Hyper-V running on Windows Server 2008 R2.

Microsoft has a new blog post on the Windows 8 blog that covers this topic and I believe you should read it before you get started:
Note: I have already created a new Virtual Disk and new Virtual Machine outlined in previous posts on my blog:
Now that we have our Virtual Machine created we will need to configure our it to load the new Windows 8 OS. From inside the Hyper-V Manager you need to select and then right click on the new Virtual Machine that you are loading Windows 8 on and select Settings as show below:

Next we will need to configure the IDE Controller that host the DVD Drive to load the Windows 8 ISO image we downloaded earlier. You do this by selecting the correct IDE Controller (IDE Controller 1) in the image below:


In the "Media" section it asks you to specify the media to use with your virtual CD/DVD drive. Note how I selected Image file option and then browsed to where I download the Windows 8 ISO?

Next you need to click on Apply to set these changes to our new Virtual Machine.

You are now ready to start up the Virtual Machine by right clicking on the Virtual Machine name and selecting Start:

As your Virtual Machine starts it will boot up from the DVD and start your Windows 8 Install. Below are the steps to install Windows 8:

As I am in the United States I accept the defaults and click Next:


 Once you have clicked Next you will see the below screen, click on the Install Now button:


After click on the Install Now button you will see Windows 8 give you the "Setup is Starting" message as shown below:


As usual Microsoft wants you to agree to their licensing terms. Select the "I accept the licensing terms" check box and then click on the Next button:


After agreeing to the licensing terms and clicking Next you will need to select which type of installation you want. I chose Custom which in my case means a new install:


Now you need to tell Windows 8 where to install. As I only added one Virtual Hard Disk to my Virtual Machine there is only one option where to install Windows 8 and it is selected by default. Click Next:


Windows 8 will start the install processes as shown below:


NOTE: the longest part of any windows install is the expanding windows files step and Windows 8 is not exception so be patient:


Once all of the files are expanded and Windows 8 finishes the next few steps you will have to go through multiple restarts / reboots as show below:




Once the restarts/reboots are complete you are greeted with another Licensing screen where you need once again to say you accept the terms to be for sure, for sure. Click the I accept check box and then click the Accept button:


Now that you have accepted the licensing terms you will now start the personalization phase of the install. Below are the usual screens when setting up Windows:





The next screen is where you decide what type of log on you will be using. Windows 8 is designed to leverage you Windows Live ID and I will be using this, but for a debug machine I want to use a local account. In the below Screen select "Don't want to log on with a Windows Live ID?":


In the below screen you want to click on the "Local Account" button that is not highlighted by default:

Fill out the below screen with your user credentials and then click the Next button (highlighted in Red) that will light up once you have completed filling out the screen:


Once you click Next in the above screen you will then watch Windows 8 finish setting up your Virtual Machine:




Congratulations! You have now installed Windows 8 in a Virtual Machine!

Hyper-V: Creating a new virtual machine

I do a lot of debugging and am also involved in a lot of technology previews. In my experience I have best been served experiencing and debugging new technology on virtual machines. As I am about to install the new Windows 8 OS on a Virtual Machine I thought I would share the steps I follow when setting up a new VM. Below is an article from Microsofts TechNet that describes how to create a virtual machine but it lacks the detail that someone new to Virtual Machines would need:
Below are images that show how I filled out the Virtual Machine Wizard:







NOTE: how I am selecting an existing Virtual Hard Disk? You can see how I created the new disk in this blog post: http://nkeithtaylor.blogspot.com/2011/09/hyper-v-creating-new-hard-disk-for-your.html


Once you click Finish in the Virtual Machine Wizard, Microsoft Hyper-V will create your new Virtual Machine that will be our starting point for installing Windows 8 in this case but can easily accept almost any OS.

Hyper-V: Creating a new hard disk for your new virtual machine

Here is a good article that I found on Microsofts TechNet site that gives you the basic steps to create a new hard disk for your new virtual machine:
I will include some images that show the options I chose as I walked through the wizard step by step:








Once the wizard progress dialog completes the hard disk wizard closes and your new hard disk is ready for use in a Virtual Machine.

You will notice from the screens that I was creating a small debug machine which is why I did not need a very big hard disk.