Wat zeggen we over ‘Microsoft Surface’

How to install Surface SDK 1.0 SP1 on Windows 7 64 bit and Visual Studio 2010

Suppose a customer asks you to update that wonderful Surface v1 application you wrote ages ago, but you don’t have the SDK installed on your new development machine running Windows 7 64 bit and Visual Studio 2010, you might have a problem, since the SDK cannot be installed. Bummer. But the change has to be deployed tomorrow! Don’t panic, read on. Let me guide you through 15 steps. Let me remind you that this procedure is not at all supported by Microsoft, but it works. And that’s the most important part.

UPDATE: 15/12/2011: Thanks to Florian Haag for the corrections and suggestions. However he’s still struggling with a very annoying bug. Perhaps you can help him out.

1. Relax

The steps are not at all difficult, but you have to remain focussed. Have a coffee, a tea, a fresh pint of beer.

2. Prerequisites

Make sure these are installed:

and you have the Surface SDK 1.0 SP1 file (SurfaceSDKWE.msi) somewhere on your computer.

Create a temporary directory where you will put all the edited files, let’s say c:\Surface.

3. Extract Surface SDK Files

Start the Visual Studio Command prompt with admin privileges and go to the directory where SurfaceSDKWE.msi file is located.

Execute following command in the command window:

msiexec /a SurfaceSDKWE.msi /qb TARGETDIR=c:\surface

Make sure you replace c:\surface with the directory name you created in the previous step. This directory will now contain all installation files.

4. Download Windows 7.0 SDK

Download the Windows 7.0 SDK Web installer. We need to use orca (to patch the surface installer) and corflags (to patch the surface executables).

Important: You need to download Windows 7.0 SDK since this one is working with .Net 3.5. Do not use Windows 7.1 SDK since that one is using .Net 4.0.

04_01 - download Orca

Make sure you check the option .Net development tools.

5. Install Orca

Install Orca. The installer file is located in C:\Program Files\Microsoft SDKs\Windows\V7.0\bin

05_01 - Install Orca

6. Patch msi file

Start Orca and open the SurfaceSDKWE.msi file from the c:\surface directory.

Go to Launch conditions in the left navigation.

06_01 - Remove settings

Make sure you select all highlighted entries, then choose Tables->Drop Row(s) from the menu.

06_02 - Remove settings

Close Orca and save the changes.

7. Patch setupcustomaction.exe

Open the Windows 7 x64 DEBUG Build Environment command prompt (with admin privileges) that has been installed as part of the Windows 7 SDK. It is labeld CMD Shell in the SDK’s start menu folder.

Change the current directory to c:\surface\Microsoft Surface\v1.0 and execute the corflags command:

corflags setupcustomaction.exe /32bit+ /force /nologo

07_01 - corflags

You will receive a warning that you can ignore.

07_02 - corflags

8. Install the Surface SDK

Now, it is time to install the SDK like you would on the original machine configuration.

08_01 - install surface sdk 1.0

9. Patch the executables

In order to run the Surface executables on your 64bit system, you need to patch them with corflags. Execute these commands in the Windows 7 x64 DEBUG Build Environment command prompt with admin privileges (CMD Shell in the SDK’s start menu folder):

cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\GenTag”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo /UpgradeCLRHeader

cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\Simulator”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo /UpgradeCLRHeader

cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\SurfaceStress”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo

cd “C:\Program Files (x86)\Microsoft Surface\v1.0”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo

10. Verify: Surface Simulator

If all went well, you will now be able to start the Surface Simulator.

10_01 - test simulator

11. Copy the VS 2010 templates

The Surface project and item templates are only installed for Visual Studio 2008, so you have to copy them to the appropriate directory.

You will find the original templates in the directory c:\Program Files (x86)\Microsoft SDKs\Surface\v1.0

11-01 - kopieer templates

Copy the contents of the Item Templates directory to c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Surface\1033

Copy the contents of the Project Templates directory to c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Surface\1033

12. Register the templates

Execute the following command in the command prompt (with admin privileges):

“c:\program files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe” /setup

13. Create a new Surface project in VS 2010

Open Visual Studio 2010, create a new project, but make sure you select “Surface” from the left navigation panel (and not the subdirectory v2.0) and .Net Framework 3.5

13_01 - visual studio

14. Alter the platform target

Make sure you alter the platform target of the project to x86. Believe me, you will forget!

14_01 - output x86

As Florian Haag mentioned in his comment, you could alter this in the project template. This way, you only have to change this once.

15. Build and enjoy the work

That’s it. You have performed all necessary steps. Step 13 & 14 must be repeated for every project.

Enable Wake-on-LAN on Surface

A customer required for this new fancy project that the Microsoft Surface tables could be switched on and off automatically. The most obvious solution was to suggest Wake-on-LAN (WOL) for switching on the unit. However, I wanted to make sure that this was supported, but couldn’t find anything on the Internet. So I tried it myself and want to share my experiences with you in this step by step guide. It’s a little odd that there is no specific Microsoft solution, while the company has high interest for saving power (see Windows 7 efforts). The Surface unit consumes +/- 250W and even when switched off it still consumes +/-15W. Using your own alternatives to save on energy should be applauded.

What do you have to do?

  1. Alter BIOS-settings
  2. Update network settings in Vista
  3. Use program to send WOL-packets

1. Alter BIOS-settings

The BIOS of the Surface unit is protected by a standard password. You can retrieve this password from Microsoft Surface Support. Call:

  • 0800 76259 for Belgium
  • (1)866-425-8880 for US

Make sure you have the serial number of the Surface unit at had. Connect a keyboard and mouse to Surface and start the unit. As soon as you’ve switched it on, hit the DEL key a few times every second so you enter the BIOS. You will be prompted to enter the password.

Enter the password that was provided to you by Microsoft Surface Support. Take care: your keyboard is configured as qwerty!

Choose “Power” using left and right arrows and APM configuration using up and down arrows. Hit enter.

Enable the settings “Power On By PCI Devices” and “Power On By PCIE Devices”.  Close the BIOS (saving the settings) and let the Surface Unit startup normally.

2. Alter network settings in Vista

Log on with your administrator credentials. Go to Control Panel, start up Device Manager, expand Network adapters and request the properties page for the network card (Intel (R) Pro/1000 PL Network Controller in my case).

Go to the Power Management Tab and select “Allow this device to wake the computer”. Choose OK to quit the screen. Make sure you have a static IP address, by changing the settings of the local area connection.

Update the settings to match your network configuration. Now it is time to write down the MAC address of your network card. You can find this, by running ipconfig /all from the command prompt.

Next to Physical Address, you will find something like XX-XX-XX-XX-XX-XX. Make sure you have written down the MAC address and the fixed IP address of the Surface Machine. Switch to user mode and shut down the unit by pressing the soft power key.

3. Use program to send WOL-packets

It’s time to test! You can now send Wake-On-Lan packets to the Surface unit to start the machine. If you want to integrate this in your .Net programming, there are some examples to be found on the net (I didn’t test this example). You can also use a little client program to send Wake-On-Lan packets. I used WOL – Magic Packet Sender and it worked just fine.

Fill in the IP address as host name and MAC address and hit “Send”. You will hear the fan of the Surface Unit start to spin and your precious Surface will boot.

Microsoft Surface Partner

We zijn verrukt te mogen aankondigen dat Jimability vanaf heden Microsoft® Surface™ Partner is.

We geloven in een sterke samenwerking met Microsoft en daarom vonden wij het opportuun om deze te bezegelen in de vorm van een partnerschap. Ook u als mogelijke klant hebt hierbij baat. Als partner kunnen wij u met de beste raad bijstaan bij uw Surface project, zowel wat de aankoop van de hardware betreft, het uitdenken van de multi user ervaringen en de ontwikkeling ervan. U hoeft zich dan weinig zorgen te maken over de uitwerking van de technische details, die lossen wij in samenspraak met Microsoft voor u op.